方法一:
(去掉第一个opencms)
第一种方法、安装时采用配置虚拟目录来安装,即把opencms.war放到webapp目录下进行安装。
在D:\MyTools\Tomcat 6.0\conf\server.xml 中找到以下配置片断:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
......
</Host>
修改以上配置,然后在<Host></Host>之间加入一行配置,最后形式如下:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false"
xmlValidation="false" xmlNamespaceAware="false" deployOnStartup="false">
<Context path="" docBase="D:\MyTools\Tomcat 6.0\webappswebapps\opencms" />
......
</Host>
然后在\Tomcat6.0\webapps\opencms\WEB-INF\web.xml 中找到以下配置片断:
<context-param>
<param-name>DefaultWebApplication</param-name>
<param-value>ROOT</param-value>
</context-param>
把以上配置片断修改为以下形式:
<context-param>
<param-name>DefaultWebApplication</param-name>
<param-value>opencms</param-value>
</context-param>
重新启动Tomcat 服务,利用http://localhost:8080/opencms 访问默认站点
(去掉第二opencms目录)
1、在D:\MyTools\Apache2.2\conf\httpd.conf中找到
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
这两项,然后把前边的#去掉,修改后为
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
2、然后在\conf\http.conf文件的结尾追加以下配置片断!(路径为你tomcat的实际安装路径)
NameVirtualHost *:80
<VirtualHost *:80>
<Directory D:/MyTools/Tomcat 6.0/webapps/opencms/">
Order allow,deny
Allow from all
</Directory>
ServerName localhost
ServerAdmin test@test.com
DocumentRoot "D:/MyTools/Tomcat 6.0/webapps/opencms/"
ErrorLog logs/error.log
SetEnvIf Request_URI "\/opencms\/*" redirect
CustomLog logs/localhost-access.log common env=!redirect
ProxyPass /opencms/ !
RedirectPermanent /opencms/ http://localhost/
ProxyPass /resources/ !
ProxyPass /export/ !
ProxyPass / http://localhost:8080/opencms/
ProxyPassReverse / http://localhost:8080/opencms/
</VirtualHost>
3、然后在\Tomcat 6.0\webapps\opencms\WEB-INF\config\opencms-importexport.xml中找到
<vfs-prefix>${CONTEXT_NAME}${SERVLET_NAME}</vfs-prefix>
删除其中的${SERVLET_NAME},修改后为
<vfs-prefix>${CONTEXT_NAME}</vfs-prefix>
然后在\Tomcat 6.0\webapps\opencms\WEB-INF\config\opencms-system.xml中找到
<sites>
<workplace-server>http://localhost:8080</workplace-server>
<default-uri>/sites/default/</default-uri>
<site server="http://localhost:8080" uri="/sites/default/"/>
</sites>
删除其中的:8080,修改后为
<sites>
<workplace-server>http://localhost</workplace-server>
<default-uri>/sites/default/</default-uri>
<site server="http://localhost" uri="/sites/default/"/>
</sites>
在\Tomcat 6.0\conf\server.xml中找到
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
修改配置为下面这样
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
proxyName="localhost" proxyPort="80"/>
6、重启apache和tomcat在网页地址栏输入http://localhost即可
---------------------------------------------------------------------------------------------------------------------------------------------------------
方法二:
(去掉第一个opencms目录)
安装时采用ROOT安装。
即把opencms.war改名为ROOT.war放到webapp下进行安装。这样第一个/opencms 就去掉了,也不用配置其他参数。
(去掉第二个opencms目录)
使用urlrewrite实现,一般在百度都能搜索到,搜索关键字:urlrewrite-3.2.0.jar(必须是这个版本,别的没有测试过)
1、下载完以后,把urlrewritefilter-3.2.0.zip里面的/WEB-INF/lib/urlrewrite-3.2.0.jar放到opencms/WEB-INF/lib/里。
2、在opencms/WEB-INF/目录下新建一个urlrewrite.xml文件,里面的内容为:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
"http://tuckey.org/res/dtds/urlrewrite3.2.dtd">
<!--
Configuration file for UrlRewriteFilter
http://tuckey.org/urlrewrite/
-->
<urlrewrite>
<rule>
<from>^/tc-mgr/(.*)$</from>
<to>/tc-mgr/$1</to>
</rule>
<rule>
<condition type="request-uri" operator="notequal">^/export/.*$</condition>
<condition type="request-uri" operator="notequal">^/resources/.*$</condition>
<condition type="request-uri" operator="notequal">^/opencms-errorhandler/.*$</condition>
<condition type="request-uri" operator="notequal">^/webdav/.*$</condition>
<condition type="request-uri" operator="notequal">^/opencms/.*$</condition>
<condition type="request-uri" operator="notequal">^/setup/.*$</condition>
<from>^/(.*)$</from>
<to>/opencms/$1</to>
</rule>
</urlrewrite>
3、创建好以后,打开/WEB-INF/web.xml文件,找到以下代码:
<listener>
<listener-class>org.opencms.main.OpenCmsListener</listener-class>
</listener>
然后在其后面加上:
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>confReloadCheckInterval</param-name>
<param-value>-1</param-value>
</init-param>
<init-param>
<param-name>logLevel</param-name>
<param-value>ERROR</param-value>
</init-param>
<init-param>
<param-name>statusEnabled</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>statusPath</param-name>
<param-value>/status</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
打开/WEB-INF/config/opencms-importexport.xml
找到代码:<vfs-prefix>${CONTEXT_NAME}${SERVLET_NAME}</vfs-prefix>
删除其中的${SERVLET_NAME},修改为: <vfs-prefix>${CONTEXT_NAME}</vfs-prefix>
第二个opencms的去除已成功。
记得修改完毕之后需要重启服务器才可。
在浏览器中输入http://localhost:8080即可访问
(去掉第一个opencms)
第一种方法、安装时采用配置虚拟目录来安装,即把opencms.war放到webapp目录下进行安装。
在D:\MyTools\Tomcat 6.0\conf\server.xml 中找到以下配置片断:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
......
</Host>
修改以上配置,然后在<Host></Host>之间加入一行配置,最后形式如下:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false"
xmlValidation="false" xmlNamespaceAware="false" deployOnStartup="false">
<Context path="" docBase="D:\MyTools\Tomcat 6.0\webappswebapps\opencms" />
......
</Host>
然后在\Tomcat6.0\webapps\opencms\WEB-INF\web.xml 中找到以下配置片断:
<context-param>
<param-name>DefaultWebApplication</param-name>
<param-value>ROOT</param-value>
</context-param>
把以上配置片断修改为以下形式:
<context-param>
<param-name>DefaultWebApplication</param-name>
<param-value>opencms</param-value>
</context-param>
重新启动Tomcat 服务,利用http://localhost:8080/opencms 访问默认站点
(去掉第二opencms目录)
1、在D:\MyTools\Apache2.2\conf\httpd.conf中找到
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
这两项,然后把前边的#去掉,修改后为
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
2、然后在\conf\http.conf文件的结尾追加以下配置片断!(路径为你tomcat的实际安装路径)
NameVirtualHost *:80
<VirtualHost *:80>
<Directory D:/MyTools/Tomcat 6.0/webapps/opencms/">
Order allow,deny
Allow from all
</Directory>
ServerName localhost
ServerAdmin test@test.com
DocumentRoot "D:/MyTools/Tomcat 6.0/webapps/opencms/"
ErrorLog logs/error.log
SetEnvIf Request_URI "\/opencms\/*" redirect
CustomLog logs/localhost-access.log common env=!redirect
ProxyPass /opencms/ !
RedirectPermanent /opencms/ http://localhost/
ProxyPass /resources/ !
ProxyPass /export/ !
ProxyPass / http://localhost:8080/opencms/
ProxyPassReverse / http://localhost:8080/opencms/
</VirtualHost>
3、然后在\Tomcat 6.0\webapps\opencms\WEB-INF\config\opencms-importexport.xml中找到
<vfs-prefix>${CONTEXT_NAME}${SERVLET_NAME}</vfs-prefix>
删除其中的${SERVLET_NAME},修改后为
<vfs-prefix>${CONTEXT_NAME}</vfs-prefix>
然后在\Tomcat 6.0\webapps\opencms\WEB-INF\config\opencms-system.xml中找到
<sites>
<workplace-server>http://localhost:8080</workplace-server>
<default-uri>/sites/default/</default-uri>
<site server="http://localhost:8080" uri="/sites/default/"/>
</sites>
删除其中的:8080,修改后为
<sites>
<workplace-server>http://localhost</workplace-server>
<default-uri>/sites/default/</default-uri>
<site server="http://localhost" uri="/sites/default/"/>
</sites>
在\Tomcat 6.0\conf\server.xml中找到
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
修改配置为下面这样
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
proxyName="localhost" proxyPort="80"/>
6、重启apache和tomcat在网页地址栏输入http://localhost即可
---------------------------------------------------------------------------------------------------------------------------------------------------------
方法二:
(去掉第一个opencms目录)
安装时采用ROOT安装。
即把opencms.war改名为ROOT.war放到webapp下进行安装。这样第一个/opencms 就去掉了,也不用配置其他参数。
(去掉第二个opencms目录)
使用urlrewrite实现,一般在百度都能搜索到,搜索关键字:urlrewrite-3.2.0.jar(必须是这个版本,别的没有测试过)
1、下载完以后,把urlrewritefilter-3.2.0.zip里面的/WEB-INF/lib/urlrewrite-3.2.0.jar放到opencms/WEB-INF/lib/里。
2、在opencms/WEB-INF/目录下新建一个urlrewrite.xml文件,里面的内容为:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
"http://tuckey.org/res/dtds/urlrewrite3.2.dtd">
<!--
Configuration file for UrlRewriteFilter
http://tuckey.org/urlrewrite/
-->
<urlrewrite>
<rule>
<from>^/tc-mgr/(.*)$</from>
<to>/tc-mgr/$1</to>
</rule>
<rule>
<condition type="request-uri" operator="notequal">^/export/.*$</condition>
<condition type="request-uri" operator="notequal">^/resources/.*$</condition>
<condition type="request-uri" operator="notequal">^/opencms-errorhandler/.*$</condition>
<condition type="request-uri" operator="notequal">^/webdav/.*$</condition>
<condition type="request-uri" operator="notequal">^/opencms/.*$</condition>
<condition type="request-uri" operator="notequal">^/setup/.*$</condition>
<from>^/(.*)$</from>
<to>/opencms/$1</to>
</rule>
</urlrewrite>
3、创建好以后,打开/WEB-INF/web.xml文件,找到以下代码:
<listener>
<listener-class>org.opencms.main.OpenCmsListener</listener-class>
</listener>
然后在其后面加上:
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>confReloadCheckInterval</param-name>
<param-value>-1</param-value>
</init-param>
<init-param>
<param-name>logLevel</param-name>
<param-value>ERROR</param-value>
</init-param>
<init-param>
<param-name>statusEnabled</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>statusPath</param-name>
<param-value>/status</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
打开/WEB-INF/config/opencms-importexport.xml
找到代码:<vfs-prefix>${CONTEXT_NAME}${SERVLET_NAME}</vfs-prefix>
删除其中的${SERVLET_NAME},修改为: <vfs-prefix>${CONTEXT_NAME}</vfs-prefix>
第二个opencms的去除已成功。
记得修改完毕之后需要重启服务器才可。
在浏览器中输入http://localhost:8080即可访问