apache二級域名設(shè)置及其圖像、js、css及請求地址的處理
apache 二級域名設(shè)置及其圖像、js 、css 及請求地址的處理1. 在系統(tǒng)文件夾下的host 添加各級域名2. 配置tomcat ,指定一級域名,二級域名以別名的形式添加,如下: www.siC
apache 二級域名設(shè)置及其圖像、js 、css 及請求地址的處理
1. 在系統(tǒng)文件夾下的host 添加各級域名
2. 配置tomcat ,指定一級域名,二級域名以別名的形式添加,如下: unpackWARs="true" autoDeploy="true">
3.apache 的conf 目錄下,修改httpd.conf 文件
Include conf/extra/httpd-vhosts.conf //前面的'#'號去掉
4. 修改apache/conf/extra目錄下的httpd-vhosts.conf 文件,如下:
1)NameVirtualHost *:80 //前面的'#'號去掉
2) 設(shè)置一級域名
ServerName www.japhone.cc //與tomcat 的一級域名對應(yīng) ErrorLog "logs/japhone-error.log"
CustomLog "logs/japhone-access.log" common
ProxyRequests off
ProxyVia on
ProxyPass
/images/ ! //將以images 、css 、js 為請求的都交給apache 處理
ProxyPass /css/ !
ProxyPass /js/ !
ProxyPass / ajp://www.japhone.cc:8009/ //其它響應(yīng)交給tomcat 處理
ProxyPassReverse / ajp://www.japhone.cc:8009/ //
3) 二級域名設(shè)置
,ServerName www.siChuan.japhone.cc //指定二級域名
DocumentRoot
D:/cndjw/cndjw //注:這里的documentroot 一定不能省略,是指該二級域名可訪問的路徑,這
//要與
ServerAlias
www.siChuan.japhone.cc //與tomcat 的別名保持一致
ErrorLog "logs/japhone-error.log"
CustomLog "logs/japhone-access.log" common
ProxyRequests off
ProxyVia on
ProxyPass
/images/ ! //將以images 、css 、js 為請求的都交給apache 處理
ProxyPass /css/ !
ProxyPass /js/ !
ProxyPass /
ajp://www.japhone.cc:8009/siChuan/ //其它請求交給tomcat 處理
ProxyPassReverse / ajp://www.japhone.cc:8009/siChuan/
ServerName www.anHui.japhone.cc
DocumentRoot D:/cndjw/cndjw
ServerAlias www.anHui.japhone.cc
ErrorLog "logs/japhone-error.log"
CustomLog "logs/japhone-access.log" common
ProxyRequests off
ProxyVia on
ProxyPass
/images/ !
ProxyPass /css/ !
ProxyPass /js/ !
ProxyPass / ajp://www.japhone.cc:8009/anHui/
ProxyPassReverse / ajp://www.japhone.cc:8009/anHui/
,Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
4)二級域名的地址中,有可能會調(diào)用根目錄的請求,可以這樣配置: ProxyPass /common/ ajp://www.japhone.cc:8009/common/
ProxyPassReverse /common/ ajp://www.japhone.cc:8009/common/
注意,這個可以寫在全局中,也可以寫在某個二級域名中,寫在二級域名的配置中的時候要注意,一定要寫在“ProxyPass / ajp:??”之前,遵循子目錄配置在前,父目錄配置在后的原則。
完成!