環境為Solaris 8+Apache+tomcat+mod_jk2
要配置虛擬主機
需修改Apache底下的httpd.conf和Tomcat底下的server.xml
假設專案是在/opt/app/tomcat/webapps/myApp
而網域名為www.testapp.com
httpd.conf加入
NameVirtualHost *:80
<VirtualHost *:80>
Documentroot /apache/htdocs
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /opt/app/tomcat/webapps/myApp
ServerName www.testapp.com
DirectoryIndex index.jsp
ErrorLog logs/dummy-ecom-test.com-error_log
CustomLog logs/dummy-ecom-test.com-access_log common
</VirtualHost>
server.xml加入
<Host name="www.testapp.com" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="myApp" debug="0"
reloadable="true" crossContext="true"/>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
</Host>
主要是目錄跟網域名在這兩個檔案的設定要一致
這樣就完成虛擬主機的設定了
沒有留言:
張貼留言