nginx.conf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #include /etc/nginx/conf.d/*.conf;
  19. gzip on;
  20. gzip_min_length 1k;
  21. gzip_buffers 4 16k;
  22. gzip_http_version 1.1;
  23. gzip_comp_level 2;
  24. gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
  25. gzip_vary on;
  26. gzip_proxied expired no-cache no-store private auth;
  27. gzip_disable "MSIE [1-6]\.";
  28. upstream gateway {
  29. server 172.30.0.81;
  30. server 172.30.0.82;
  31. }
  32. server {
  33. listen 8000;
  34. server_name web;
  35. root /usr/share/nginx/html;
  36. location /{
  37. index index.html;
  38. error_page 404 /index.html;
  39. }
  40. location ~ ^/(api/)?actuator {
  41. return 403;
  42. }
  43. location ^~ /oauth/redirect {
  44. rewrite ^(.*)$ /index.html break;
  45. }
  46. location ^~ /api/ {
  47. proxy_redirect off;
  48. proxy_set_header Host $host;
  49. proxy_set_header X-Real-IP $remote_addr;
  50. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  51. proxy_buffering off;
  52. rewrite ^/api/(.*)$ /$1 break;
  53. proxy_pass http://gateway/;
  54. }
  55. }
  56. }