server { listen 80; server_name _; root /app/public; index index.php index.html; #必须放在解析PHP之前 #禁止目录执行php SATRT location ~* ^/(h5|guoqi|static|upload)/.*\.(php|php5|php7|php8)$ { default_type application/json; return 200 '{"message":"You are definitely a particularly bad big fool."}'; } #禁止目录执行php END include /opt/docker/etc/nginx/enable-php.conf; location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) { return 404; } location ~ \.well-known{ allow all; } if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) { return 403; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; error_log /dev/null; access_log /dev/null; } location ~ .*\.(js|css)?$ { expires 12h; error_log /dev/null; access_log /dev/null; } # 访问日志 access_log /docker.stdout; error_log /docker.stderr; }