nginx - 副本.conf 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. worker_processes 1;
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include mime.types;
  7. default_type application/octet-stream;
  8. sendfile on;
  9. keepalive_timeout 65;
  10. server {
  11. listen 8002;
  12. server_name localhost;
  13. charset utf-8;
  14. location / {
  15. root F:/warewms/ams/dist;
  16. try_files $uri $uri/ /index.html;
  17. index index.html index.htm;
  18. }
  19. location /prod-api/ {
  20. proxy_set_header Host $http_host;
  21. proxy_set_header X-Real-IP $remote_addr;
  22. proxy_set_header REMOTE-HOST $remote_addr;
  23. proxy_set_header X-Forwarded-For
  24. $proxy_add_x_forwarded_for;
  25. proxy_pass http://localhost:8008/;
  26. }
  27. location /stage-api/ {
  28. proxy_set_header Host $http_host;
  29. proxy_set_header X-Real-IP $remote_addr;
  30. proxy_set_header REMOTE-HOST $remote_addr;
  31. proxy_set_header X-Forwarded-For
  32. $proxy_add_x_forwarded_for;
  33. proxy_pass http://localhost:8008/;
  34. }
  35. error_page 500 502 503 504 /50x.html;
  36. location = /50x.html {
  37. root html;
  38. }
  39. }
  40. server {
  41. listen 8003;
  42. server_name localhost;
  43. charset utf-8;
  44. location / {
  45. root html/dist; //相对地址 比如:html/index
  46. try_files $uri $uri/ /index.html;
  47. index index.html index.htm;
  48. }
  49. location /prod-api/ {
  50. proxy_set_header Host $http_host;
  51. proxy_set_header X-Real-IP $remote_addr;
  52. proxy_set_header REMOTE-HOST $remote_addr;
  53. proxy_set_header X-Forwarded-For
  54. $proxy_add_x_forwarded_for;
  55. proxy_pass http://localhost:8008/;
  56. }
  57. location /stage-api/ {
  58. proxy_set_header Host $http_host;
  59. proxy_set_header X-Real-IP $remote_addr;
  60. proxy_set_header REMOTE-HOST $remote_addr;
  61. proxy_set_header X-Forwarded-For
  62. $proxy_add_x_forwarded_for;
  63. proxy_pass http://localhost:8008/;
  64. }
  65. error_page 500 502 503 504 /50x.html;
  66. location = /50x.html {
  67. root html;
  68. }
  69. }
  70. }