nginx.conf 899 B

12345678910111213141516171819202122232425262728293031323334
  1. worker_processes auto;
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include /etc/nginx/mime.types;
  7. default_type application/octet-stream;
  8. server {
  9. listen 80;
  10. # 配置静态文件的路径
  11. location / {
  12. root /usr/share/nginx/html;
  13. index index.html;
  14. try_files $uri $uri/ /index.html;
  15. }
  16. # 配置反向代理
  17. location /prod-api/ {
  18. proxy_pass http://kxmall3-demo:8585/; # 将 prod-api/ 请求代理到 kxmall3-demo 服务
  19. proxy_set_header Host $host;
  20. proxy_set_header X-Real-IP $remote_addr;
  21. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  22. proxy_set_header X-Forwarded-Proto $scheme;
  23. }
  24. error_page 500 502 503 504 /50x.html;
  25. location = /50x.html {
  26. root /usr/share/nginx/html;
  27. }
  28. }
  29. }