评:本人 设置 为

gzip on; 


 server { 

 listen 80; 

 server_name localhost; 


 #charset koi8-r; 


 #access_log logs/host.access.log main; 


 location / { 

 root html; 

 index index.html index.htm; 

 } 


 location ~ .*.*$ { 

 index index.jsp; 

 proxy_pass http://127.0.0.1:8080; 

 proxy_set_header X-Real-IP $remote_addr; 

 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

 proxy_set_header Host $http_host; 

 }




一般利用nginx做代理,网上搜索的资料均为下面这种方式:

在nginx.conf中

server { 

 listen 80; 

 server_name localhost; 

 root /home/mysite/public_html; 


 location / { 

 index index.html index.htm index.jsp; 

 } 


 location ~ .*.jsp$ 

 { 

 index index.jsp; 

 proxy_pass http://localhost:8080; 

 proxy_set_header X-Real-IP $remote_addr; 

 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

 proxy_set_header Host $http_host; 


 }


location ~ \.action$ { 

 proxy_pass http://localhost:8080; 

 proxy_set_header X-Real-IP $remote_addr; 

 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

 proxy_set_header Host $http_host; 

 } 


 location ~ ^/WEB-INF/* { 

 proxy_pass http://localhost:8080; 

 proxy_set_header X-Real-IP $remote_addr; 

 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

 proxy_set_header Host $http_host; 

 } 


 error_page 500 502 503 504 /50x.html; 

 location = /50x.html { 

 root html; 

 } 

 }