#REWRITE-START URL重写规则引用
include /www/server/panel/vhost/rewrite/tui.xxx.com.conf;
#REWRITE-END
ERROR: 检测到配置文件有错误,请先排除后再操作
nginx version: nginx/1.26.3
nginx: [emerg] directive “rewrite” is not terminated by “;” in /www/server/panel/vhost/nginx/tuixxx.com.conf:63
nginx: configuration file /www/server/nginx/conf/nginx.conf test failed
# 动态sitemap配置
location = /sitemap.xml {
rewrite ^(.*)$ /index.php?class=sitemap last;
}
# 自定义伪静态规则
location / {
if (!-e $request_filename) {
rewrite ^/([^/]+)/([0-9]+)\.html$ /index.php?class=$1&view=$2 last;
rewrite ^/(seo|articles)/?$ /index.php?class=$1 last;
rewrite ^/(seo|articles)/page/([0-9]+)/?$ /index.php?class=$1&page=$2 last;
rewrite ^/(seo|articles)/tag/([^/]+)/?$ /index.php?class=$1&tag=$2 last;
rewrite ^/(seo|articles)/([0-9]{4})/([0-9]{2})/?$ /index.php?class=$1&year=$2&month=$3 last;
}
}
// … existing code …
sec2:
server {
listen 80;
listen 443 ssl;
listen 443 quic;
listen [::]:443 ssl;
listen [::]:443 quic;
http2 on;
listen [::]:80;
server_name xxx.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/xxx.com;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/xxx.com/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/xxx.com/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_tickets on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
add_header Alt-Svc 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"';
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-73.conf;
#PHP-INFO-END
# 动态sitemap配置
location = /sitemap.xml {
rewrite ^(.*)$ /index.php?class=sitemap last;
}
# 自定义伪静态规则
location / {
if (!-e $request_filename) {
rewrite ^/([^/]+)/([0-9]+)\.html$ /index.php?class=$1&view=$2 last;
rewrite ^/(seo|articles)/?$ /index.php?class=$1 last;
rewrite ^/(seo|articles)/page/([0-9]+)/?$ /index.php?class=$1&page=$2 last;
rewrite ^/(seo|articles)/tag/([^/]+)/?$ /index.php?class=$1&tag=$2 last;
rewrite ^/(seo|articles)/([0-9]{4})/([0-9]{2})/?$ /index.php?class=$1&year=$2&month=$3 last;
}
}
# 模板目录访问控制
location ~ ^/view/muban/(default|daishua)/ {
try_files $uri $uri/ /index.php?$args;
}
# 静态资源缓存
location ~* \.(css|js|jpg|jpeg|png|gif|ico|woff2|ttf|woff)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
access_log off;
add_header Access-Control-Allow-Origin *;
error_log /dev/null;
}
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) {
return 404;
}
# 一键申请SSL证书验证目录相关设置
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;
}
access_log /www/wwwlogs/xxx.com.log;
error_log /www/wwwlogs/xxx.com.error.log;
}