java source code deployment summary: Environment: nginx + tomcat Deployment: deployment source Source directory / Chroot2 / test / schedule directory is the source of all tomcat 位置: /usr/local/tomcat/apache-tomcat-scheduleweb-test The main configuration file server.xml <Host name="localhost" appBase="/chroot2/test/schedule" deployOnStartup ="false" autoDeploy="false" unpackWARs="true"> <Context path="/schedule" docBase="."/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="schedule-web-test.cn-access_log." suffix=".log" pattern="common" resolveHosts="false"/> </Host> Main Note: <Context path = "/ schedule" docBase = / "."> Configuration nginx configuration upstream configuration: upstream tomcat_schedule_web_test{ server localhost:8291 weight=10; } server configuration: server { listen 80; server_name test.schedule.toys178.com; index index.jsp index.htm index.php; root /chroot2/test; fastcgi_connect_timeout 600; fastcgi_send_timeout 600; fastcgi_read_timeout 600; location /schedule { proxy_pass http://tomcat_schedule_web_test; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|apk|tar.gz)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /chroot/wwwlogs/tomcat_schedule_web_test-access.log access; } Deployment: war package deployment war package directory / Chroot2 / test / schedule directory is placed below war package, such as: ScheduleManage.war tomcat 位置: /usr/local/tomcat/apache-tomcat-scheduleweb-test The main configuration file server.xml <Host name="localhost" appBase="/chroot2/test/schedule" deployOnStartup ="false" autoDeploy="false" unpackWARs="true"> <Context path="/schedule" docBase="ScheduleManage.war"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="schedule-web-test.cn-access_log." suffix=".log" pattern="common" resolveHosts="false"/> </Host> Main Note: <Context path = "/ schedule" docBase = "ScheduleManage.war" /> Configuration nginx configuration upstream configuration: upstream tomcat_schedule_web_test{ server localhost:8291 weight=10; } server configuration: server { listen 80; server_name test.schedule.toys178.com; index index.jsp index.htm index.html; root /chroot2/test; location /schedule { proxy_pass http://tomcat_schedule_web_test; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|apk|tar.gz)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /chroot/wwwlogs/tomcat_schedule_web_test-access.log access; }