nginx动态和静态请求分离
- upstream java_api{
- server 127.0.0.1:8080;
- }
- server {
- listen 80;
- server_name localhost;
-
- #charset koi8-r;
- access_log /var/log/nginx/log/host.access.log main;
- root /opt/app/code;
-
- location ~ \.jsp$ { # 动态请求处理
- proxy_pass http://java_api;
- index index.html index.htm;
- }
-
-
- location ~ \.(jpg|png|gif)$ { # 静态请求处理
- expires 1h;
- gzip on;
- }
-
- location /{
- index index.html index.htm;
- }
-
- }