Java项目的路径为:/var/data/www/m.qcai360.com/
Java项目的域名为:m.qcai360.com
PHP项目的路径为:/var/www/html/
PHP项目的域名为:www.qcai360.com
2、配置Apache配置文件httpd.conf
[root@localhost ~]# vi /etc/httpd/conf/httpd.conf3、配置Tomcat配置文件server.xml
打开编辑Apache的配置文件,找到VirtualHost节点,去掉#注释。核心代码如下:
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/html ServerName www.qcai360.com ErrorLog logs/www.qcai360.com-error_log CustomLog logs/www.qcai360.com-access_log common </VirtualHost> <VirtualHost *:80> ServerName m.qcai360.com ErrorLog logs/m.qcai360.com-error_log CustomLog logs/m.qcai360.com-access_log common <Directory "/var/data/www/m.qcai360.com/"> DirectoryIndex index.htm index.jsp index.html </Directory> DocumentRoot /var/data/www/m.qcai360.com/ <IfModule mod_proxy.c> ProxyPass / ajp://127.0.0.1:8009/ ProxyPassReverse / ajp://127.0.0.1:8009/ </IfModule> </VirtualHost>
[root@localhost ~]# vi /usr/share/tomcat6/conf/server.xml
打开编辑Tomcat的配置文件,我把几个核心节点配置展示下,其他节点几乎不用改动。
Connector节点:
<Connector port="8888" protocol="HTTP/1.1" URIEncoding="UTF-8" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" connectionTimeout="20000" acceptCount="300" maxThreads="300" maxProcessors="1000" minProcessors="5" useURIValidationHack="false" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" redirectPort="8443"/>
Host节点:
<Host name="m.qcai360.com" appBase="/var/data/www/m.qcai360.com/" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="/" docBase="/var/data/www/m.qcai360.com/" reloadable="true" caseSensitive="false" debug="0"></Context> </Host>
浏览器中输入: http://www.qcai360.com/
运行效果如下:
浏览器中输入: http://m.qcai360.com
运行效果如下:
更多精彩内容 : http://www.code4apk.com/