close
Tomcat + Apache 虛擬主機的設定
一、背景資料
1.一台伺服器,假設IP為10.112.1.1 & 10.112.1.2
2.NAT IP 分別為 203.74.224.51 & 203.74.224.40
3.已在DNS登錄過的Domain:proxy.abacus.com.tw, www.unotour.com.tw,
二個Domain分別指向10.112.1.1(203.74.224.51) , 10.112.1.2(203.74.224.40)
3.proxy.abacus.com.tw 分為三個AP:ProxyDemo/Proxy/DataBahn
4.假設這二個網站資料的存放地點
proxy.abacus.com.tw/ProxyDemo的資料在 D:WeblinkProxyDemo
proxy.abacus.com.tw/Proxy的資料在 D:WeblinkProxy
proxy.abacus.com.tw/DataBahn的資料在 D:WeblinkDataBahn
www.unotour.com.tw資料在 D:unotour
二、適用環境:apache + tomcat4.0以上(假設你已將兩者結合)
三、步驟:
1.修改apache的httpd.conf檔,找到NameVirtualHost這一區塊,
最後加上以下的設定
############這是proxy.abacus.com.tw的虛擬主機設定############
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:Weblink
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
JkMount /ProxyDemo/servlet/* ajp13
JkMount /ProxyDemo/*.jsp ajp13
JkMount /Proxy/servlet/* ajp13
JkMount /Proxy/*.jsp ajp13
JkMount /DataBahn/servlet/* ajp13
JkMount /DataBahn/*.jsp ajp13
ServerName proxy.abacus.com.tw
ErrorLog logs/weblink-error.log
CustomLog logs/weblink-access.log common
###如不允許使用IP, 以下可不設定
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:Weblink
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
JkMount /ProxyDemo/servlet/* ajp13
JkMount /ProxyDemo/*.jsp ajp13
JkMount /Proxy/servlet/* ajp13
JkMount /Proxy/*.jsp ajp13
JkMount /DataBahn/servlet/* ajp13
JkMount /DataBahn/*.jsp ajp13
ServerName 10.112.1.1
ErrorLog logs/weblink-error.log
CustomLog logs/weblink-access.log common
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:Weblink
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
JkMount /ProxyDemo/servlet/* ajp13
JkMount /ProxyDemo/*.jsp ajp13
JkMount /Proxy/servlet/* ajp13
JkMount /Proxy/*.jsp ajp13
JkMount /DataBahn/servlet/* ajp13
JkMount /DataBahn/*.jsp ajp13
ServerName 203.74.224.51
ErrorLog logs/weblink-error.log
CustomLog logs/weblink-access.log common
############proxy.abacus.com.tw虛擬主機設定結束############
############這是www.unotour.com.tw的虛擬主機設定############
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:unotour
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
ServerName www.unotour.com.tw
ErrorLog logs/unotour-error.log
CustomLog logs/unotour-access.log common
###如不允許使用IP, 以下可不設定
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:unotour
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
ServerName 10.112.1.2
ErrorLog logs/unotour-error.log
CustomLog logs/unotour-access.log common
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:unotour
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
ServerName 203.74.224.40
ErrorLog logs/unotour-error.log
CustomLog logs/unotour-access.log common
############www.unotour.tw虛擬主機設定結束############
2.tomcat的設定,修改tomcat/conf下的server.xml,找到,在它下一行插入以下設定
############這是proxy.abacus.com.tw的虛擬主機設定############
203.74.224.51
10.112.1.1
reloadable="true" crossContext="false">
prefix="ProxyDemo_log." suffix=".txt" timestamp="true"/>
reloadable="true" crossContext="false">
prefix="Proxy_log." suffix=".txt" timestamp="true"/>
reloadable="true" crossContext="false">
prefix="DataBahn_log." suffix=".txt" timestamp="true"/>
directory="logs" prefix="home_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
############proxy.abacus.com.tw虛擬主機設定結束############
############這是www.unotour.com.tw的虛擬主機設定############
203.74.224.40
10.112.1.2
prefix="home_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
############www.unotour.tw虛擬主機設定結束############
四、將tomcat和apache關閉,重新啟動apache後再啟動tomcat,試試看在瀏覽器上打不同的Domain,是否會看到不一樣的東西?
一、背景資料
1.一台伺服器,假設IP為10.112.1.1 & 10.112.1.2
2.NAT IP 分別為 203.74.224.51 & 203.74.224.40
3.已在DNS登錄過的Domain:proxy.abacus.com.tw, www.unotour.com.tw,
二個Domain分別指向10.112.1.1(203.74.224.51) , 10.112.1.2(203.74.224.40)
3.proxy.abacus.com.tw 分為三個AP:ProxyDemo/Proxy/DataBahn
4.假設這二個網站資料的存放地點
proxy.abacus.com.tw/ProxyDemo的資料在 D:WeblinkProxyDemo
proxy.abacus.com.tw/Proxy的資料在 D:WeblinkProxy
proxy.abacus.com.tw/DataBahn的資料在 D:WeblinkDataBahn
www.unotour.com.tw資料在 D:unotour
二、適用環境:apache + tomcat4.0以上(假設你已將兩者結合)
三、步驟:
1.修改apache的httpd.conf檔,找到NameVirtualHost這一區塊,
最後加上以下的設定
############這是proxy.abacus.com.tw的虛擬主機設定############
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:Weblink
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
JkMount /ProxyDemo/servlet/* ajp13
JkMount /ProxyDemo/*.jsp ajp13
JkMount /Proxy/servlet/* ajp13
JkMount /Proxy/*.jsp ajp13
JkMount /DataBahn/servlet/* ajp13
JkMount /DataBahn/*.jsp ajp13
ServerName proxy.abacus.com.tw
ErrorLog logs/weblink-error.log
CustomLog logs/weblink-access.log common
###如不允許使用IP, 以下可不設定
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:Weblink
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
JkMount /ProxyDemo/servlet/* ajp13
JkMount /ProxyDemo/*.jsp ajp13
JkMount /Proxy/servlet/* ajp13
JkMount /Proxy/*.jsp ajp13
JkMount /DataBahn/servlet/* ajp13
JkMount /DataBahn/*.jsp ajp13
ServerName 10.112.1.1
ErrorLog logs/weblink-error.log
CustomLog logs/weblink-access.log common
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:Weblink
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
JkMount /ProxyDemo/servlet/* ajp13
JkMount /ProxyDemo/*.jsp ajp13
JkMount /Proxy/servlet/* ajp13
JkMount /Proxy/*.jsp ajp13
JkMount /DataBahn/servlet/* ajp13
JkMount /DataBahn/*.jsp ajp13
ServerName 203.74.224.51
ErrorLog logs/weblink-error.log
CustomLog logs/weblink-access.log common
############proxy.abacus.com.tw虛擬主機設定結束############
############這是www.unotour.com.tw的虛擬主機設定############
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:unotour
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
ServerName www.unotour.com.tw
ErrorLog logs/unotour-error.log
CustomLog logs/unotour-access.log common
###如不允許使用IP, 以下可不設定
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:unotour
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
ServerName 10.112.1.2
ErrorLog logs/unotour-error.log
CustomLog logs/unotour-access.log common
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot D:unotour
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
AllowOverride None
deny from all
DirectoryIndex index.html index.htm index.jsp
ServerName 203.74.224.40
ErrorLog logs/unotour-error.log
CustomLog logs/unotour-access.log common
############www.unotour.tw虛擬主機設定結束############
2.tomcat的設定,修改tomcat/conf下的server.xml,找到,在它下一行插入以下設定
############這是proxy.abacus.com.tw的虛擬主機設定############
reloadable="true" crossContext="false">
prefix="ProxyDemo_log." suffix=".txt" timestamp="true"/>
reloadable="true" crossContext="false">
prefix="Proxy_log." suffix=".txt" timestamp="true"/>
reloadable="true" crossContext="false">
prefix="DataBahn_log." suffix=".txt" timestamp="true"/>
directory="logs" prefix="home_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
############proxy.abacus.com.tw虛擬主機設定結束############
############這是www.unotour.com.tw的虛擬主機設定############
prefix="home_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
############www.unotour.tw虛擬主機設定結束############
四、將tomcat和apache關閉,重新啟動apache後再啟動tomcat,試試看在瀏覽器上打不同的Domain,是否會看到不一樣的東西?
全站熱搜
留言列表