default.conf.template 851 B

1234567891011121314151617181920212223242526272829303132
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. server_name localhost;
  5. gzip on;
  6. gzip_static on;
  7. gzip_comp_level 6;
  8. gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  9. location / {
  10. root /usr/share/nginx/html;
  11. #index index.html;
  12. try_files $uri $uri/ /index.html;
  13. client_max_body_size 300m; #最大接受300m文件以内的
  14. client_body_timeout 20s;
  15. }
  16. location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css){
  17. root /usr/share/nginx/html;
  18. expires 7d;
  19. }
  20. #error_page 404 /404.html;
  21. # redirect server error pages to the static page /50x.html
  22. #
  23. error_page 500 502 503 504 /50x.html;
  24. location = /50x.html {
  25. root /usr/share/nginx/html;
  26. }
  27. }