# This is a default site configuration which will simply return 404, preventing # chance access to any other virtualhost. server { listen 80 default_server; root /app/public; client_max_body_size 50M; index index.php index.html index.htm default.php default.htm default.html; # Everything is a 404 location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi-74.sock; fastcgi_index index.php; include fastcgi.conf; } # 对静态资源添加缓存 location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot|otf|mp4|webp)$ { expires 30d; add_header Cache-Control "public, no-transform"; } location ~^/ { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; } } # You may need this to prevent return 404 recursion. location = /404.html { internal; } }