nginx.conf 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. user root;
  2. worker_processes 4;
  3. events {
  4. worker_connections 1024;
  5. }
  6. http {
  7. include mime.types;
  8. default_type application/octet-stream;
  9. sendfile on;
  10. keepalive_timeout 65;
  11. client_max_body_size 500M;
  12. server {
  13. listen 8000;
  14. server_name energyService;
  15. location / {
  16. root html/dist/;
  17. index index.html;
  18. try_files $uri $uri/ /index.html =404;
  19. client_max_body_size 500M;
  20. }
  21. location /api/{
  22. proxy_pass http://192.168.50.235:16300/;
  23. #客户端真实ip
  24. proxy_set_header X-Real-IP $remote_addr;
  25. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  26. }
  27. location /tiles {
  28. alias /usr/share/nginx/static/roadmap;
  29. autoindex on;
  30. expires 30d;
  31. access_log off;
  32. add_header Cache-Control "public";
  33. }
  34. error_page 500 502 503 504 /50x.html;
  35. location = /50x.html {
  36. root html;
  37. }
  38. location /transDataWeb/ {
  39. proxy_pass http://192.168.50.241:9002/;
  40. proxy_set_header Host $host:$server_port;
  41. proxy_set_header X-Real-IP $remote_addr;
  42. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  43. proxy_set_header X-Forwarded-Proto $scheme;
  44. proxy_set_header X-Forwarded-Host $host; # 传递原始请求的主机头
  45. }
  46. }
  47. }