nginx.conf 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. user nginx;
  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. keepalive_timeout 65;
  17. server {
  18. listen 80;
  19. server_name localhost;
  20. location / {
  21. # 不缓存html,防止程序更新后缓存继续生效
  22. if ($request_filename ~* .*\.(?:htm|html)$) {
  23. add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
  24. access_log on;
  25. }
  26. root /soybean-admin/;
  27. index index.html index.htm;
  28. try_files $uri $uri/ /index.html;
  29. }
  30. # location /soybean/soybean-webserver/v1 {
  31. # proxy_set_header Host $host;
  32. # proxy_set_header X-Real-IP $remote_addr;
  33. # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  34. # proxy_set_header REMOTE-HOST $remote_addr;
  35. # # 后台接口地址
  36. # proxy_pass http://192.168.1.99:30597/v1;
  37. # proxy_redirect default;
  38. # add_header Access-Control-Allow-Origin *;
  39. # add_header Access-Control-Allow-Headers X-Requested-With;
  40. # add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
  41. # }
  42. error_page 500 502 503 504 /50x.html;
  43. location = /50x.html {
  44. root /usr/share/nginx/html;
  45. }
  46. }
  47. }