nginx.conf 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. worker_processes 1;
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include mime.types;
  7. default_type application/octet-stream;
  8. sendfile on;
  9. keepalive_timeout 65;
  10. # 开启gzip压缩
  11. gzip on;
  12. # 不压缩临界值,大于1K的才压缩,一般不用改
  13. gzip_min_length 1k;
  14. # 压缩缓冲区
  15. gzip_buffers 16 64K;
  16. # 压缩版本(默认1.1,前端如果是squid2.5请使用1.0)
  17. gzip_http_version 1.1;
  18. # 压缩级别,1-10,数字越大压缩的越好,时间也越长
  19. gzip_comp_level 5;
  20. # 进行压缩的文件类型
  21. gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
  22. # 跟Squid等缓存服务有关,on的话会在Header里增加"Vary: Accept-Encoding"
  23. gzip_vary on;
  24. # IE6对Gzip不怎么友好,不给它Gzip了
  25. gzip_disable "MSIE [1-6]\.";
  26. # 设置上传文件大小限制为100MB
  27. client_max_body_size 4000M;
  28. server {
  29. listen 80;
  30. server_name localhost;
  31. charset utf-8;
  32. location / {
  33. root /home/zxt/soft/taais-ui/;
  34. try_files $uri $uri/ /index.html;
  35. index index.html index.htm;
  36. }
  37. location /prod-api/ {
  38. proxy_set_header Host $http_host;
  39. proxy_set_header X-Real-IP $remote_addr;
  40. proxy_set_header REMOTE-HOST $remote_addr;
  41. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  42. proxy_pass http://localhost:9090/;
  43. }
  44. error_page 500 502 503 504 /50x.html;
  45. location = /50x.html {
  46. root html;
  47. }
  48. }
  49. }