nginx.conf 873 B

123456789101112131415161718192021222324252627282930
  1. server {
  2. listen 80;
  3. server_name example.com www.example.com;
  4. root D:\projects\nideshop/www;
  5. set $node_port 8360;
  6. index index.js index.html index.htm;
  7. if ( -f $request_filename/index.html ){
  8. rewrite (.*) $1/index.html break;
  9. }
  10. if ( !-f $request_filename ){
  11. rewrite (.*) /index.js;
  12. }
  13. location = /index.js {
  14. proxy_http_version 1.1;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  17. proxy_set_header Host $http_host;
  18. proxy_set_header X-NginX-Proxy true;
  19. proxy_set_header Upgrade $http_upgrade;
  20. proxy_set_header Connection "upgrade";
  21. proxy_pass http://127.0.0.1:$node_port$request_uri;
  22. proxy_redirect off;
  23. }
  24. location ~ /static/ {
  25. etag on;
  26. expires max;
  27. }
  28. }