nginx.conf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log notice;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 1024;
  7. use epoll;
  8. multi_accept on;
  9. }
  10. http {
  11. include /etc/nginx/mime.types;
  12. # 加载外部配置
  13. include /etc/nginx/app_conf/lq_admin_server.conf;
  14. include /etc/nginx/app_conf/sub_system_server.conf;
  15. default_type application/octet-stream;
  16. # 日志格式
  17. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  18. '$status $body_bytes_sent "$http_referer" '
  19. '"$http_user_agent" "$http_x_forwarded_for"';
  20. access_log /var/log/nginx/access.log main;
  21. # 基本配置
  22. sendfile on;
  23. tcp_nopush on;
  24. tcp_nodelay on;
  25. keepalive_timeout 65;
  26. types_hash_max_size 2048;
  27. client_max_body_size 10M;
  28. # Gzip 压缩
  29. gzip on;
  30. gzip_vary on;
  31. gzip_min_length 1024;
  32. gzip_proxied any;
  33. gzip_comp_level 6;
  34. gzip_types
  35. text/plain
  36. text/css
  37. text/xml
  38. text/javascript
  39. application/json
  40. application/javascript
  41. application/xml+rss
  42. application/atom+xml
  43. image/svg+xml;
  44. # 安全头
  45. add_header X-Frame-Options "SAMEORIGIN" always;
  46. add_header X-Content-Type-Options "nosniff" always;
  47. add_header X-XSS-Protection "1; mode=block" always;
  48. add_header Referrer-Policy "no-referrer-when-downgrade" always;
  49. }