nginx.conf 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. user root;
  2. worker_processes 1;
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 1024;
  7. }
  8. http {
  9. include /etc/nginx/mime.types;
  10. default_type application/octet-stream;
  11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  12. '$status $body_bytes_sent "$http_referer" '
  13. '"$http_user_agent" "$http_x_forwarded_for"';
  14. access_log /var/log/nginx/access.log main;
  15. sendfile on;
  16. #tcp_nopush on;
  17. keepalive_timeout 65;
  18. #gzip on;
  19. #include /etc/nginx/conf.d/*.conf;
  20. upstream gateway {
  21. server 172.30.0.81;
  22. server 172.30.0.82;
  23. }
  24. server {
  25. listen 8000;
  26. server_name web;
  27. root /usr/share/nginx/html;
  28. location /{
  29. index index.html;
  30. error_page 404 /index.html;
  31. }
  32. location ^~ /oauth/redirect {
  33. rewrite ^(.*)$ /index.html break;
  34. }
  35. location ^~ /api {
  36. proxy_set_header Host $host;
  37. proxy_set_header X-Real-IP $remote_addr;
  38. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  39. proxy_buffering off;
  40. rewrite ^/api/(.*)$ /$1 break;
  41. proxy_pass http://gateway;
  42. }
  43. }
  44. }