掲示板

Run liferay on non root context

15年前 に David Latty によって更新されました。

Run liferay on non root context

Junior Member 投稿: 96 参加年月日: 08/06/16 最新の投稿
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
15年前 に James Min によって更新されました。

RE: Run liferay on non root context

Expert 投稿: 293 参加年月日: 06/08/14 最新の投稿
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=/
15年前 に David Latty によって更新されました。

RE: Run liferay on non root context

Junior Member 投稿: 96 参加年月日: 08/06/16 最新の投稿
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
15年前 に James Min によって更新されました。

RE: Run liferay on non root context

Expert 投稿: 293 参加年月日: 06/08/14 最新の投稿
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.
15年前 に David Latty によって更新されました。

RE: Run liferay on non root context

Junior Member 投稿: 96 参加年月日: 08/06/16 最新の投稿
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.
15年前 に Christoph H. によって更新されました。

RE: Run liferay on non root context

Regular Member 投稿: 147 参加年月日: 07/07/31 最新の投稿
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
14年前 に Ralf Eichinger によって更新されました。

RE: Run liferay on non root context

New Member 投稿: 8 参加年月日: 08/07/01 最新の投稿
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?
14年前 に Sandeep Jha によって更新されました。

RE: Run liferay on non root context

New Member 投稿: 13 参加年月日: 07/10/30 最新の投稿
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
14年前 に Ziggy R によって更新されました。

RE: Run liferay on non root context

Expert 投稿: 293 参加年月日: 08/06/08 最新の投稿
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
14年前 に Lisa Simpson によって更新されました。

RE: Run liferay on non root context

Liferay Legend 投稿: 2034 参加年月日: 09/03/05 最新の投稿
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
14年前 に Olaf Kock によって更新されました。

RE: Run liferay on non root context

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
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
14年前 に Trever Shick によって更新されました。

RE: Run liferay on non root context

New Member 投稿: 6 参加年月日: 09/07/01 最新の投稿
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
14年前 に Karolin Anna Krieg によって更新されました。

RE: Run liferay on non root context

Junior Member 投稿: 53 参加年月日: 09/12/17 最新の投稿
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
14年前 に Rajeeva Lochana BR によって更新されました。

RE: Run liferay on non root context

Junior Member 投稿: 67 参加年月日: 10/01/04 最新の投稿
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
10年前 に Iuliana Cosmina によって更新されました。

RE: Run liferay on non root context

New Member 投稿: 1 参加年月日: 13/09/10 最新の投稿
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.
9年前 に Deepjyoti Nath によって更新されました。

RE: Run liferay on non root context

New Member 投稿: 2 参加年月日: 14/03/03 最新の投稿
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
9年前 に Olaf Kock によって更新されました。

RE: Run liferay on non root context

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
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
10年前 に Christoph Rabel によって更新されました。

RE: Run liferay on non root context

Liferay Legend 投稿: 1554 参加年月日: 09/09/24 最新の投稿
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.