文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>how to setup multy domains

how to setup multy domains

时间:2007-03-26  来源:zyq26672607

install tomcat 5.0.x ,apache 2.0 ,mysql and opencms.

Rename the opencms.war to ROOT.war. This is needed to make the OpenCms application the main application. I assume that you have no other web-app running on your server. Copy the ROOT.war to your TomCat directory. In my case this is "opttomcat5webapps". Start/restart the TomCat service and wait until it is fully loaded. After this, you should find a new directory named "ROOT" in the same direcotry as your ROOT.war. Install OpenCms in the known way. This is actually quiet easy and you should not have any troubles by doing this.

The next, confige some file

Before edit confige file.please backup all files of tomcat . apache and opencms

Configuring OpenCms

Now, open the OpenCms configuration file /opt/tomcat5/webapps/ROOT/WEB-INF/config/opencms.properties. And locate the app.name key, and change the value to:
app.name=ROOT

In the /opt/tomcat5/webapps/ROOT/WEB-INF/config/opencms-importexport.xml configuration file, into the staticexport/rendersettings node you have to remove any occurrence of the ${CONTEXT_NAME} variable. After editing, it has to look similar to:
${CONTEXT_NAME}/export ${CONTEXT_NAME} false http://127.0.0.1:8080/handle404 … In the /opt/tocmat5/webapps/ROOT/WEB-INF/config/opencms-system.xml configuration file, into the system/sites node you have to configure your site, in this example it has to look similar to:
<sites>
<workplace-server>http://www.jinxiaofeng.com<workplace-server>
<default-uri>/sites/default/</default-uri>
<site server="http://www.jinxiaofeng.com" uri="/sites/default/"/>
</sites>
This is all that you have to do in the OpenCms configuration.

Please note: After you have made these changes, OpenCms will run correctly until you have also made the changes described below in the Tomcat and Apache configuration.

Specifying Aliases

You can have more than one server name pointing to the same root folder by adding an alias to the site node. Take care that you assign every server name only once. An example of such a configuration can be seen from the listing beneath:
<site server="http://www.jinxiaofeng.com" uri="/sites/mysite/">
<alias server="http://www.jinxiaofeng.com"/>
<alias server="http://www.jinxiaofeng1.com"/>
</site>

secure a site

This section explains how to secure resources, so that they are transmitted via the https protocol. To activate this feature for your site, you have to add a node secure in the site configuration:
<site server="http://www.jinxiaofeng.com" uri="/sites/mysite/">
<secure server="https://www.jinxiaofeng.com"/>
</site>

Of course, aliases and a secure site can be combined in one site node. However, you can have only one secure server. To secure a file, select the export/secure option in the context-menu of your resource. Now, you get a dialog with a radio inputs for securing a resouce, for activating the static export, and for marking the resource as internal, so that the page cannot be requested any more. If the secure page contains external data like images, stylesheets or javascripts, they need to be located in the /system folder, so that they can be transmitted via a secure and a normal server. Flags given to a folder are valid for all resources that are inside this folder.

Config the tomcat server.xml file

Locate the file server.xml in the /opt/tomcat5/conf/ directory. Before making any changes, make a backup copy of this file.

Here is how the server.xml file looks after making all required changes to it:

<Server port="8005" shutdown="SHUTDOWN" debug="0"> 
<Service name="localhsot">
<!-- Define a connector for the "public visible" server name -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8081" minProcessors="5" maxProcessors="75"
proxyName="www.jinxiaofeng.com" proxyPort="80"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8082" minProcessors="5" maxProcessors="75"
proxyName="www.jinxiaofeng1.com" proxyPort="80"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<Engine name="Standalone" defaultHost="localhost" debug="0">
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<!-- You can change "unpackWARs" and "autoDeploy" to false after the installation is finished -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
</Host>
</Engine>
</Service>
</Server>

You should copy and paste this code to your server.xml and change the server name ${DOMAIN_NAME} to your own server name.

This should be all you need to configure Tomcat. Please note that the "standard" standalone connector usually available at port 8080 has been removed, and so is not longer available. Also, all Tomcat options unrelated to OpenCms have been removed. In case you are using other Tomcat web applications that require further settings for in your server.xml , you must merge these with the OpenCms settings decribed above.

Configuring Apaches httpd.conf

Before you config this config , you must install apacher 2.0.x
First, make sure you have the following Apache modules enabled
LoadModule alias_module modules/mod_alias.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
The next ,you should config the visulthost in the /etc/apache2/vhosts.d/00_default_vhost.conf file.
<VirtualHost *:80>
ServerName www.jinxiaofeng.com
ServerAdmin [email protected]
DocumentRoot "/opt/tomcat5/webapps/ROOT/"
ErrorLog logs/error.log
# Log only non-redirect requests in "normal" log file
SetEnvIf Request_URI "/opencms/*" redirect
CustomLog logs/www.jinxiaofeng.com-access.log common env=!redirect
ProxyPass /opencms/ !
RedirectPermanent /opencms/ http://www.jinxiaofeng.com/
ProxyPass /resources/ !
ProxyPass /export/ !
ProxyPass / http://localhost:8081/opencms/
ProxyPassReverse / http://localhost:8081/opencms/
</VirtualHost>
<VirtualHost *:80>
ServerName www.jinxiaofeng1.com
ServerAdmin [email protected]
DocumentRoot "/opt/tomcat5/webapps/ROOT/"
ErrorLog logs/error.log
# Log only non-redirect requests in "normal" log file
SetEnvIf Request_URI "/opencms/*" redirect
CustomLog logs/www.jinxiaofeng1.com-access.log common env=!redirect
ProxyPass /opencms/ !
RedirectPermanent /opencms/ http://www.jinxiaofeng1.com/
ProxyPass /resources/ !
ProxyPass /export/ !
ProxyPass / http://localhost:8082/opencms/
ProxyPassReverse / http://localhost:8082/opencms/
</VirtualHost>

Update the hosts file

In the /etc/hosts file . you must add the www.jinxiaofeng1.com and www.jinxiaofeng.com .now the config file is finished.

tomcat-5.5+apache2.0.x+opencms6.2.2

First.you install tomcat-5.5 and apache2.0.x
empty the webapps folder. and stop the tomcat.and change the opencms.war to ROOT.war. then start the tomcat.

change the opencms config file

change the opencms-system.xml file
To /var/lib/tomcat-5.5/webapps/ROOT/WEB-INF/conf/opencms-system.xml file.change the node

<sites>
<workplace-server>www.lxbing.com</workplace-server>
<default-uri>/sites/default/</default-uri>
<site server="http://www.lxbing.com" uri="/sites/default/"/>
<site server="http://www.jim.com" uri="/sites/default/demopages"/>
</sites>


If after you config all the file from this document.but not init the opencms.you should change the

<workplace-server>www.lxbing.com</workplace-server>

to

<workplace-server>http://192.168.0.133:8080</workplace-server>

config the opencms-importexport.xml file
change the node to:

<rendersettings>
<rfs-prefix>export</rfs-prefix>
<vfs-prefix>${SERVLET_NAME}</vfs-prefix>
<userelativelinks>false</userelativelinks> <exporturl>http://127.0.0.1:8080${SERVLET_NAME}/handle404</exporturl>
<plainoptimization>true</plainoptimization>
<testresource uri="/system/shared/page.dtd"/>
<resourcestorender>
<regex>/sites/.*</regex>
<regex>/system/galleries/.*</regex>
<regex>/system/modules/.*/resources/.*</regex>
</resourcestorender>
</rendersettings>

config the sever.xml file
In to ${tomcat}/conf/server.xml .replace the follow to it:

<Server port="8005" shutdown="SHUTDOWN" debug="0"> 
<Service name="Catalina">
<!-- Define a connector for the "public visible" server name -->
<Connector port="8080" minProcessors="5" maxProcessors="75"
proxyName="www.lxbing.com" proxyPort="80"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<Connector port="8081" minProcessors="5" maxProcessors="75"
proxyName="www.jim.com" proxyPort="80"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<Engine name="Catalina" defaultHost="localhost" debug="0">
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<!-- You can change "unpackWARs" and "autoDeploy" to false after the installation is finished -->
</Host>
</Engine>
</Service>
</Server>

please note the connection node.

config the httpd

to /etc/apache2/httpd.conf file. add some :
LoadModule alias_module modules/mod_alias.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

config the 00_default_vhost.conf

to the /etc/apache2/vhost.d/ .open the 00_default_vhost.conf file.
<VirtualHost *:80>
<Directory "/var/lib/tomcat-5.5/webapps/ROOT/">
Order allow,deny
Allow from all
</Directory>
ServerName www.lxbing.com
ServerAdmin [email protected]
DocumentRoot "/var/lib/tomcat-5.5/webapps/ROOT/"
ErrorLog logs/error.log
# Log only non-redirect requests in "normal" log file
# SetEnvIf Request_URI "/opencms/*" redirect
# CustomLog logs/localhost-access.log common env=!redirect
ProxyPass /opencms/ http://www.lxbing.com/
RedirectPermanent /opencms/ http://www.lxbing.com/

ProxyPass /resources/ http://192.168.0.133:8080/resources/
ProxyPass /export/ http://192.168.0.133:8080/export/
ProxyPass / http://192.168.0.133:8080/opencms/
ProxyPassReverse / http://192.168.0.133:8080/opencms/
</VirtualHost>

<VirtualHost *:80>
<Directory "/var/lib/tomcat-5.5/webapps/ROOT/">
Order allow,deny
Allow from all
</Directory>
ServerName www.jim.com
ServerAdmin [email protected]
DocumentRoot "/var/lib/tomcat-5.5/webapps/ROOT/"
ErrorLog logs/error.log
# Log only non-redirect requests in "normal" log file
SetEnvIf Request_URI "/opencms/*" redirect
CustomLog logs/localhost-access.log common env=!redirect
ProxyPass /opencms/ !
RedirectPermanent /opencms/ http://www.jim.com

ProxyPass /resources/ http://192.168.0.133:8081/resources/
ProxyPass /export/ http://192.168.0.133:8081/export/

ProxyPass / http://192.168.0.133:8081/opencms/
ProxyPassReverse / http://192.168.0.133:8081/opencms/
</VirtualHost>

now. all finished. if you hava any question.please ask me by email.

相关阅读 更多 +
排行榜 更多 +
剑术大乱斗

剑术大乱斗

动作格斗 下载
南钛HSSE

南钛HSSE

商务办公 下载
战场攻防大乱斗

战场攻防大乱斗

飞行射击 下载