default.conf 947 B

12345678910111213141516171819202122232425262728293031
  1. # This is a default site configuration which will simply return 404, preventing
  2. # chance access to any other virtualhost.
  3. server {
  4. listen 80 default_server;
  5. root /app/public;
  6. client_max_body_size 50M;
  7. index index.php index.html index.htm default.php default.htm default.html;
  8. # Everything is a 404
  9. location ~ [^/]\.php(/|$) {
  10. try_files $uri =404;
  11. fastcgi_pass unix:/tmp/php-cgi-74.sock;
  12. fastcgi_index index.php;
  13. include fastcgi.conf;
  14. }
  15. # 对静态资源添加缓存
  16. location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot|otf|mp4|webp)$ {
  17. expires 30d;
  18. add_header Cache-Control "public, no-transform";
  19. }
  20. location ~^/ {
  21. if (!-e $request_filename){
  22. rewrite ^(.*)$ /index.php?s=$1 last;
  23. }
  24. }
  25. # You may need this to prevent return 404 recursion.
  26. location = /404.html {
  27. internal;
  28. }
  29. }