Combination View Flat View Tree View
Threads [ Previous | Next ]
David Latty
Run liferay on non root context
July 7, 2008 10:36 AM
Answer

David Latty

Rank: Junior Member

Posts: 96

Join Date: June 15, 2008

Recent Posts

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
James Min
RE: Run liferay on non root context
July 7, 2008 12:05 PM
Answer

James Min

LIFERAY STAFF

Rank: Expert

Posts: 293

Join Date: August 14, 2006

Recent Posts

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
RE: Run liferay on non root context
July 7, 2008 7:51 PM
Answer

David Latty

Rank: Junior Member

Posts: 96

Join Date: June 15, 2008

Recent Posts

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?
James Min
RE: Run liferay on non root context
July 8, 2008 7:59 AM
Answer

James Min

LIFERAY STAFF

Rank: Expert

Posts: 293

Join Date: August 14, 2006

Recent Posts

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
RE: Run liferay on non root context
July 8, 2008 1:09 PM
Answer

David Latty

Rank: Junior Member

Posts: 96

Join Date: June 15, 2008

Recent Posts

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.
RE: Run liferay on non root context
July 8, 2008 3:44 PM
Answer

Christoph H.

Rank: Regular Member

Posts: 147

Join Date: July 31, 2007

Recent Posts

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.
Ralf Eichinger
RE: Run liferay on non root context
July 13, 2009 4:29 AM
Answer

Ralf Eichinger

Rank: New Member

Posts: 8

Join Date: July 1, 2008

Recent Posts

I edited the config like this:
1# nano webapps/ROOT/WEB-INF/classes/portal-ext.properties
2portal.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
20: Die Anzahl der Verweise ist zu gross.

(english: amount of redirects exceeded)

What happened?
Sandeep Jha
RE: Run liferay on non root context
July 14, 2009 4:26 AM
Answer

Sandeep Jha

Rank: New Member

Posts: 13

Join Date: October 30, 2007

Recent Posts

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
Ziggy ©
RE: Run liferay on non root context
July 14, 2009 2:52 PM
Answer

Ziggy ©

Rank: Expert

Posts: 293

Join Date: June 8, 2008

Recent Posts

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
Lisa Simpson
RE: Run liferay on non root context
September 15, 2009 12:28 PM
Answer

Lisa Simpson

Rank: Liferay Legend

Posts: 2034

Join Date: March 5, 2009

Recent Posts

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.
Olaf Kock
RE: Run liferay on non root context
September 15, 2009 12:59 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1961

Join Date: September 23, 2008

Recent Posts

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.:
1   JkMount /portal tomcat
2   JkMount /my-own-theme tomcat
3   JkMount /chat-portlet tomcat
4   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.
Trever Shick
RE: Run liferay on non root context
September 25, 2009 5:12 PM
Answer

Trever Shick

Rank: New Member

Posts: 6

Join Date: July 1, 2009

Recent Posts

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.
Karolin Anna Heiss
RE: Run liferay on non root context
March 24, 2010 9:56 AM
Answer

Karolin Anna Heiss

Rank: Junior Member

Posts: 53

Join Date: December 17, 2009

Recent Posts

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
Rajeeva Lochana .B.R
RE: Run liferay on non root context
March 25, 2010 12:34 AM
Answer

Rajeeva Lochana .B.R

Rank: Junior Member

Posts: 58

Join Date: January 4, 2010

Recent Posts

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
1
2<Context path="" crossContext="true">
3
4    ......
5        ....................
6</Context>


Modified Code
1
2<Context path="/liferay" crossContext="true">
3
4    ......
5        ....................
6</Context>



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

copy paste the below code
portal.ctx=/liferay
Iuliana Cosmina
RE: Run liferay on non root context
February 20, 2014 2:01 AM
Answer

Iuliana Cosmina

Rank: New Member

Posts: 1

Join Date: September 10, 2013

Recent Posts

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.
Christoph Rabel
RE: Run liferay on non root context
February 20, 2014 4:03 AM
Answer

Christoph Rabel

Rank: Regular Member

Posts: 151

Join Date: September 24, 2009

Recent Posts

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.
Deepjyoti Nath
RE: Run liferay on non root context
June 20, 2014 7:01 AM
Answer

Deepjyoti Nath

Rank: New Member

Posts: 2

Join Date: March 3, 2014

Recent Posts

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
Olaf Kock
RE: Run liferay on non root context
June 21, 2014 3:56 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1961

Join Date: September 23, 2008

Recent Posts

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.