2013年4月27日 星期六
[tomcat] server.xml設定, UTF8, 限定IP存取,自動佈署(server.xml setting for utf8, IP access, auto deployment)
tomcat/conf/server.xml
<!--get-傳送時為utf8->
<Connector port="8080" URIEncoding="UTF-8"/>
<!--host下appBase是設定整個網站的根目錄->
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- IP Access SETTING,設定該網站允許和限制存取的ip, allow是設定可存取的ip,deny是設定拒絕存取的ip-->
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="60.251.40.*||127.0.0.1" deny=""/>
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." resolveHosts="false" suffix=".txt"/>
<!--context下 path若不填任何值,該project就變成出現在網站根目錄了,所以path是設定虛擬目錄名稱, 每個content就是設定一個虛擬目錄-->
<Context docBase="/opt/tomcat/webapps/proofmed" path="/proofmed" reloadable="true" source="org.eclipse.jst.jee.server:hospital.proofmed" />
<Context docBase="/opt/tomcat/webapps/proofdrug" path="/proofdrug" reloadable="true" source="org.eclipse.jst.jee.server:hospital.proofdrug" />
</Host>
註解:在eclipse中修改server.xml
左側專案樹 (最下面)-> Servers -> TomcatXXXX-config : server.xml