nginx.conf 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. user root;
  2. worker_processes auto;
  3. pid /run/nginx.pid;
  4. include /etc/nginx/modules-enabled/*.conf;
  5. events {
  6. worker_connections 768;
  7. }
  8. http {
  9. client_max_body_size 50M;
  10. sendfile on;
  11. tcp_nopush on;
  12. types_hash_max_size 2048;
  13. include /etc/nginx/mime.types;
  14. default_type application/octet-stream;
  15. ssl_protocols TLSv1.2 TLSv1.3;
  16. ssl_prefer_server_ciphers on;
  17. gzip on;
  18. gzip_types text/plain application/json application/javascript text/css;
  19. access_log /var/log/nginx/access.log;
  20. error_log /var/log/nginx/error.log;
  21. include /etc/nginx/conf.d/*.conf;
  22. include /etc/nginx/sites-enabled/*;
  23. server {
  24. listen 80 default_server;
  25. # server_name 不填表示匹配所有未被其他 server 匹配的请求
  26. root /usr/share/nginx/html;
  27. index index.html;
  28. location / {
  29. try_files $uri $uri/ /index.html;
  30. }
  31. # 设置.html文件不缓存
  32. location ~* \.html$ {
  33. add_header Cache-Control "no-cache, no-store, must-revalidate";
  34. add_header Pragma "no-cache";
  35. add_header Expires "0";
  36. }
  37. }
  38. }