实例一
server { listen 80; server_name test.a.com; charset utf-8; access_log /home/test.a.com.access.log; location /(css|js|fonts|img)/ { access_log off; expires 1d; root "/path/to/app_a/static"; try_files $uri @backend; } location / { try_files /_not_exists_ @backend; } location @backend { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:8080; }}
实例二
server { listen 80; server_name www.example.com; charset utf-8; access_log /home/www.example.com.access.log main; location /(css|js|fonts|img)/ { access_log off; expires 1d; root "/path/to/app_b/static"; try_files $uri @backend; } location / { try_files /_not_exists_ @backend; } location @backend { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:8081; }}