server { listen 80; server_name www.baidu.com 112.213.111.101; index index.html index.php index.htm default.php default.htm default.html; root /www/wwwroot/www.baidu.com/hou/public; #CERT-APPLY-CHECK--START include /www/server/panel/vhost/nginx/well-known/www.baidu.com.conf; #CERT-APPLY-CHECK--END include /www/server/panel/vhost/nginx/extension/www.baidu.com/*.conf; #SSL-START SSL相关配置 #error_page 404/404.html; #SSL-END #ERROR-PAGE-START error_page 404 /404.html; #ERROR-PAGE-END #PHP-INFO-START include enable-php-74.conf; #PHP-INFO-END # 根目录跳转前台 location = / { rewrite ^ /h5/ permanent; } # 前台H5 location /h5/ { try_files $uri $uri/ /h5/index.html; } # 禁止访问敏感目录 location ~ ^/(runtime|application)/ { return 403; } # ThinkPHP伪静态 + 后台API location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~* (\.user.ini|\.htaccess|\.htpasswd|\.env.*)$ { return 404; } location ~* /(\.git|\.svn|\.idea|node_modules)/ { 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 /www/wwwlogs/www.baidu.com.log; error_log /www/wwwlogs/www.baidu.com.error.log; }