nginx.conf 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 10240;
  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. # 禁止访问任何 .conf 文件
  21. location ~ \.conf$ {
  22. deny all;
  23. return 403;
  24. }
  25. location /index.html {
  26. root /usr/share/nginx/html;
  27. add_header Cache-Control "no-cache, no-store";
  28. }
  29. location / {
  30. root /usr/share/nginx/html;
  31. try_files $uri $uri/ /index.html;
  32. }
  33. error_page 500 502 503 504 /50x.html;
  34. location = /50x.html {
  35. root /usr/share/nginx/html;
  36. }
  37. }
  38. }