Tomcat configuration: nginx + tomcat configuration. for static resources, use nginx: Java code upstreamtomcat_server {server127.0.0.1: 8080;} server {listen80; server_namelocalhost; rootD: workmy-project; Java code
- Upstream tomcat_server {
- Server 127.0.0.1: 8080;
- }
- Server {
- Listen 80;
- Server_name localhost;
- Root D: \ work \ my-project;
- Location /{
- Index. jsp;
- }
- Location/j_spring_security_check {
- Proxy_set_header Host $ host;
- Proxy_set_header X-Forwarded-For $ remote_addr;
- Proxy_pass http: // tomcat_server;
- }
- Location ~ . * \. (Jsp | do) $ {
- Proxy_set_header Host $ host;
- Proxy_set_header X-Forwarded-For $ remote_addr;
- Proxy_pass http: // tomcat_server;
- }
- Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf | js | css | html) $ # set to directly read static files without passing through tomcat
- {
- Expires 30d;
- }
- Location ~ ^/(WEB-INF)/{# This is very important, or the user can access it
- Deny all;
- }
- Error_page 500 502 503 x.html;
- Location =/50x.html {
- Root html;
- }
- }
The above describes the nginx + tomcat configuration and the direct use of nginx for static resources, including the tomcat configuration content. if you are interested in the PHP Tutorial, please help.