upstream dev.node.com_pool { server 127.0.0.1:3000 max_fails=3 fail_timeout=30s; } server { listen 80; server_name dev.node.com; autoindex on; error_log /data/weblog/nginx/dev.node.com.error.log; # access_log /data/weblog/nginx/dev.node.com.access.log; root /Users/benzhan/Desktop/nodejs/nodebase/; location / { 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; if (!-f $request_filename) { proxy_pass http://dev.node.com_pool; } if (-f $request_filename) { rewrite .* /403.html; } } location /public { allow all; } # 开发环境不缓存静态文件 location ~/public/.*\.(html|css|js|eot|svg|ttf|woff|woff2|map|cur)$ { expires off; add_header Cache-Control no-cache; } }