Foros de discusión

Run liferay on non root context

David Latty, modificado hace 15 años.

Run liferay on non root context

Junior Member Mensajes: 96 Fecha de incorporación: 16/06/08 Mensajes recientes
I want to run liferay on a different context - NOT ROOT. I see a few posts on this, but no answers are given. Please tell me that there is a configuration for this somewhere - and please tell me where. This is a small thing. Please do not explain to me why there is none, but feel free to let me know if you cant - in the case that you know this to be true.

I mean really, this is a small thing. Thanks
thumbnail
James Min, modificado hace 15 años.

RE: Run liferay on non root context

Expert Mensajes: 293 Fecha de incorporación: 14/08/06 Mensajes recientes
portal.properties

make the changes in portal-ext.properties

here is the default setting. change it to your context.

##
## Portal Context
##

#
# Specify the path of the portal servlet context. This is needed because
# javax.servlet.ServletContext does not have access to the context path
# until Java EE 5.
#
# Set this property if you deploy the portal to another path besides root.
#
portal.ctx=/
David Latty, modificado hace 15 años.

RE: Run liferay on non root context

Junior Member Mensajes: 96 Fecha de incorporación: 16/06/08 Mensajes recientes
I actually came across this mentioned fix as well; however, there is no such file!

I am running Tomcat 6. There is no liferay-web.xml (as the other servers) in web-inf either. So how do I do this on tomcat?
thumbnail
James Min, modificado hace 15 años.

RE: Run liferay on non root context

Expert Mensajes: 293 Fecha de incorporación: 14/08/06 Mensajes recientes
If you are making the changes directly onto tomcat6, try creating the file portal-ext.properties in tomcat6/webapps/ROOT/WEB-INF/classes .


If you are deploying from the Ext environment, the file is in ext/ext-impl/src . Then do an ant deploy. Please note this bug as well (which has been fixed for portal-ext.properties):

http://support.liferay.com/browse/LEP-5693
http://support.liferay.com/browse/LEP-5695


Are you trying to merely change the root context? Or are you trying to do something bigger, Like change the servlet mapping? Another option is in portal.properties (make changes in portal-ext.properties):

#
# Set the private group, private user, and public servlet mapping for
# com.liferay.portal.servlet.FriendlyURLServlet. This value must match the
# servlet mapping set in web.xml.
#
# For example, if the private group pages are mapped to "/group" and the
# group's friendly URL is set to "/guest" and the layout's friendly URL is
# set to "/company/community", then the friendly URL for the page will be
# http://www.liferay.com/group/guest/company/community. Private group pages
# map to a community's private pages and are only available to authenticated
# users with the proper permissions.
#
# For example, if the public pages are mapped to "/web" and the group or
# user's friendly URL is set to "/guest" and the layout's friendly URL is
# set to "/company/community", then the friendly URL for the page will be
# http://www.liferay.com/web/guest/company/community. Public pages are
# available to unauthenticated users.
#
# The friendly URL's for users, groups, and layouts can be set during
# runtime.
#
layout.friendly.url.private.group.servlet.mapping=/group
layout.friendly.url.private.user.servlet.mapping=/user
layout.friendly.url.public.servlet.mapping=/web

Make sure to make corresponding changes in the web.xml as the comments say.


Lastly, I know several installations that do URL mappings via Apache. That is another option.
David Latty, modificado hace 15 años.

RE: Run liferay on non root context

Junior Member Mensajes: 96 Fecha de incorporación: 16/06/08 Mensajes recientes
There seems to be misunderstanding.

I want my portal to not run from the default context
root http://localhost:8080
but rather to run from a specified context, as
http://localhost:8080/specified-context


This includes the WHOLE liferay portal. The default context
http://localhost:8080
will not be used for liferay.
Christoph H., modificado hace 15 años.

RE: Run liferay on non root context

Regular Member Mensajes: 147 Fecha de incorporación: 31/07/07 Mensajes recientes
have a look at the file portal(-ext).properties in ext-imp/src or ext-impl/classes or ext-ejb/classes or portal-impl/src or portal-impl/classes depending on your liferay version, if your using the ext environment or not etc.

Theres a property
portal.ctx
which does exactly what you want.
thumbnail
Ralf Eichinger, modificado hace 14 años.

RE: Run liferay on non root context

New Member Mensajes: 8 Fecha de incorporación: 1/07/08 Mensajes recientes
I edited the config like this:
# nano webapps/ROOT/WEB-INF/classes/portal-ext.properties
portal.ctx=/portal


But after restart calling http://myserver/portal I get an infinite redirect loop:
Firefox:
"The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete."

WGET:
Verbindungsaufbau zu enterprise-1.accounts.intern|127.0.1.1|:80... verbunden.
HTTP Anforderung gesendet, warte auf Antwort... 301 Moved Permanently
Platz: /portal/c;jsessionid=CAF154B0EDA15EB333903EED9F51B6DA[folge]
20: Die Anzahl der Verweise ist zu gross.

(english: amount of redirects exceeded)

What happened?
Sandeep Jha, modificado hace 14 años.

RE: Run liferay on non root context

New Member Mensajes: 13 Fecha de incorporación: 30/10/07 Mensajes recientes
Even we had a similar requirement. When we put portal.ctx=/portal it went into an infinite loop as you mentioned.

So here is the solution which worked for us:

1. Put portal.ctx=/portal (as mentioned)
2. Also declare your context explicitly in the liferay-portal app

We have deployed Liferay on JBoss so we declared the context /portal in the following location:

/liferay-portal.war/WEB-INF/jboss-web.xml

Hope this helps.

Thanks,
Sandeep
thumbnail
Ziggy R, modificado hace 14 años.

RE: Run liferay on non root context

Expert Mensajes: 293 Fecha de incorporación: 8/06/08 Mensajes recientes
Does it not make a difference if you are using the bundled version or the war file version? I would have thought that the context root change would only work if you deploy liferay as a war file. I could be wrong emoticon
thumbnail
Lisa Simpson, modificado hace 14 años.

RE: Run liferay on non root context

Liferay Legend Mensajes: 2034 Fecha de incorporación: 5/03/09 Mensajes recientes
If you do that, you actually have to move the files out of ROOT and, in the example here, into /portal in your tomcat/webapps directory.
thumbnail
Olaf Kock, modificado hace 14 años.

RE: Run liferay on non root context

Liferay Legend Mensajes: 6392 Fecha de incorporación: 23/09/08 Mensajes recientes
Right. Depending on the concrete setup there might be more:

Starting with the tomcat bundle:
1) edit portal-ext.properties as described (portal.ctx=/portal)
2) move the directory tomcat-x.x.x/webapps/ROOT to tomcat-x.x.x/webapps/portal

If you combine apache and tomcat with mod_jk (described below) or mod_proxy:
3) make sure to forward all tomcat contexts you want from apache (e.g.:
   JkMount /portal tomcat
   JkMount /my-own-theme tomcat
   JkMount /chat-portlet tomcat
   JkMount /wol-portlet tomcat

(basically: see what directories are contained in webapps/ and choose the ones you need)

Other app servers or installations will/might vary.

Older versions (maybe up to 5.1... sorry, I don't remember) might need to change tomcat-x.x.x/conf/Catalina/localhost/ROOT.xml: edit it, change the name to portal.xml.
thumbnail
Trever Shick, modificado hace 14 años.

RE: Run liferay on non root context

New Member Mensajes: 6 Fecha de incorporación: 1/07/09 Mensajes recientes
Also, if using a pre-packaged installation of Liferay and tomcat, you'll need to rename <tomcat_root>/conf/Catalina/localhost/ROOT.xml to <new context path name>.xml.

Step 1
Rename <tomcat_root>/webapps/ROOT to rportal

Step 2
mkdir <tomcat_root>/webapps/ROOT

Step 3
Update <tomcat_root>/webapps/rportal/web-inf/classes/portal-ext.properties and set

portal.ctx=/rportal

Step 4
Rename <tomcat_root>/conf/Catalina/localhost/ROOT.xml to rportal.xml

That's it. It seemed to work for me after that.
thumbnail
Karolin Anna Krieg, modificado hace 13 años.

RE: Run liferay on non root context

Junior Member Mensajes: 53 Fecha de incorporación: 17/12/09 Mensajes recientes
I followed the description of Trever Shick but still had problems with my custom context path.
After I emptied the browser cache and deleted all temporery files in the Liferay portal it worked emoticon
thumbnail
Rajeeva Lochana BR, modificado hace 13 años.

RE: Run liferay on non root context

Junior Member Mensajes: 67 Fecha de incorporación: 4/01/10 Mensajes recientes
Hi David Latty,


Simple 5 steps to change the context

Step1: Rename the folder ROOT dir to yours own context name(Example: liferay)
Step2: Rename file ROOT.xml to liferay.xml in %LIFERAY-HOME%\conf\Catalina\localhost
Step3: Create empty Directory/Folder ROOT in %LIFERAY-HOME%\webapps\
Step4:
Original Code

<context path="" crosscontext="true">

	......
        ....................
</context>


Modified Code

<context path="/liferay" crosscontext="true">

	......
        ....................
</context>



Step5: Create file portal-ext.properties in %LIFERAY-HOME%\webapps\liferay\WEB_INF\classes\

copy paste the below code
portal.ctx=/liferay
thumbnail
Iuliana Cosmina, modificado hace 10 años.

RE: Run liferay on non root context

New Member Mensaje: 1 Fecha de incorporación: 10/09/13 Mensajes recientes
This solution works just fine if the only thing you need is running Liferay.
When you start adding your own applications things go to hell. Assuming the portal runs under http://hostname/portal, when you deploy your applications, they will run under http://hostname/app1, not under http://hostname/portal/app1.
I hope their plugin for changing the context works, otherwise, I will still be very much dissapointed in this CMS.
Deepjyoti Nath, modificado hace 9 años.

RE: Run liferay on non root context

New Member Mensajes: 2 Fecha de incorporación: 3/03/14 Mensajes recientes
Hi,
I am exactly facing the same issue and looking for a solution of how to deploy the custom build plugins (theme/portlets) on the same non root context path where the Liferay application is running.

If anybody found a solution please share.

Thanks,
Deep
thumbnail
Olaf Kock, modificado hace 9 años.

RE: Run liferay on non root context

Liferay Legend Mensajes: 6392 Fecha de incorporación: 23/09/08 Mensajes recientes
This would be dependent on your appserver, not on Liferay.

If you have the Tomcat/Apache configuration, you might have success with JkAutoAlias - I recently stumbled upon this option but have never tried it and don't know if it adds new contexts at runtime, however, it's easy to execute a "service apache2 reload" to make Apache parse it's configuration again without any interruption of service.
thumbnail
Christoph Rabel, modificado hace 10 años.

RE: Run liferay on non root context

Liferay Legend Mensajes: 1554 Fecha de incorporación: 24/09/09 Mensajes recientes
If you have a reverseproxy (apache/nginx) in front of Liferay another property might be helpful: portal.proxy.path

Add this to portal-ext.properties
portal.proxy.path=/portal

and restart.
With this property all links are prefixed with /portal. Since portal is still deployed in ROOT, the extra /portal has to be removed on access by the reverse proxy, e.g with apache:
<Location /portal>
ProxyPass ajp://localhost:8009
ProxyPassReverse ajp://localhost:8013
</Location>

Caveats:
- Reverse proxy is needed
- I have seen custom portlets and themes that don't honor this parameter (strictly speaking, they are buggy)

It's less complicated than moving context root and works rather well.