default.conf 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. server {
  2. listen 80;
  3. server_name localhost;
  4. #charset koi8-r;
  5. access_log /var/log/nginx/host.access.log main;
  6. error_log /var/log/nginx/error.log error;
  7. location / {
  8. root /usr/share/nginx/html;
  9. index index.html index.htm;
  10. try_files $uri $uri/ /index.html;
  11. }
  12. location /admin-api/ { ## 后端项目 - 管理后台
  13. proxy_pass http://119.29.146.254:48080/admin-api/; ## 重要!!!proxy_pass 需要设置为后端项目所在服务器的 IP
  14. proxy_set_header Host $http_host;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. proxy_set_header REMOTE-HOST $remote_addr;
  17. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  18. }
  19. location /app-api/ { ## 后端项目 - 用户 App
  20. proxy_pass http://119.29.146.254:48080/app-api/; ## 重要!!!proxy_pass 需要设置为后端项目所在服务器的 IP
  21. proxy_set_header Host $http_host;
  22. proxy_set_header X-Real-IP $remote_addr;
  23. proxy_set_header REMOTE-HOST $remote_addr;
  24. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  25. }
  26. #error_page 404 /404.html;
  27. # redirect server error pages to the static page /50x.html
  28. #
  29. error_page 500 502 503 504 /50x.html;
  30. location = /50x.html {
  31. root /usr/share/nginx/html;
  32. }
  33. }