nginx.conf 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/*.conf;
  14. default_type application/octet-stream;
  15. # 日志格式
  16. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  17. '$status $body_bytes_sent "$http_referer" '
  18. '"$http_user_agent" "$http_x_forwarded_for"';
  19. access_log /var/log/nginx/access.log main;
  20. # 基本配置
  21. sendfile on;
  22. tcp_nopush on;
  23. tcp_nodelay on;
  24. keepalive_timeout 65;
  25. types_hash_max_size 2048;
  26. client_max_body_size 10M;
  27. # Gzip 压缩
  28. gzip on;
  29. gzip_vary on;
  30. gzip_min_length 1024;
  31. gzip_proxied any;
  32. gzip_comp_level 6;
  33. gzip_types
  34. text/plain
  35. text/css
  36. text/xml
  37. text/javascript
  38. application/json
  39. application/javascript
  40. application/xml+rss
  41. application/atom+xml
  42. image/svg+xml;
  43. # 安全头
  44. add_header X-Frame-Options "SAMEORIGIN" always;
  45. add_header X-Content-Type-Options "nosniff" always;
  46. add_header X-XSS-Protection "1; mode=block" always;
  47. add_header Referrer-Policy "no-referrer-when-downgrade" always;
  48. }