cyclists 大佬有话说 :
wordpress nginx规则求助大佬们
无意间发现访问网站xxx.com/aaazajns时,自动加斜杠变成xxx.com/aaazajns/依然可以访问主页,这个文件夹都不存在,把那aaa一串字符改成任意字母不带斜杠访问,又自动加了斜杠直接正常访问主页,刚开始以为是主题的锅,换了wp官方的主题也是这样,全部插件停用还是这样。
按照正常来说,访问网站不存在的目录或文件会禁止访问跳转到404,我这特么还自动加了斜杠直接正常访问首页了。用的军哥lnmp ,wordpress为静态都是军哥默认的,wp5.5.1,nginx1.18版本,都没改动配置
网站配置
server
{
listen 80;
#listen [::]:80;
server_name xxxo.com;
charset utf-8;
rewrite ^/(.*) https://xxxo.com/$1 permanent;
index index.html index.htm index.php default.html default.htm default.php;
root/home/website;
include /usr/local/nginx/rocket-nginx/default.conf;
include rewrite/wordpress.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*.php$ { deny all; }
include enable-php-pathinfo.conf;
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 12h;
}
access_log off;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name xxx.com;
charset utf-8;
index index.html index.htm index.php default.html default.htm default.php;
root/home/website;
location ~ .*.(gif|jpg|jpeg|png|bmp|swf|mp4)$
{
valid_referers none blocked xxx.com;
if ($invalid_referer)
{
rewrite ^/ https://xxx.com/usr/uploads/mov/404.PNG;
return 404;
}
}
ssl_certificate /usr/ssl/inwao.ecc.pem;
ssl_certificate_key /usr/ssl/private.key;
ssl_certificate /usr/ssl/xxxo.com.crt;
ssl_certificate_key /usr/ssl/xxxo.com.key; ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /usr/ssl/xxxao.com.crt;
ssl_session_timeout 5m;
ssl_protocolsTLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
include /usr/local/nginx/rocket-nginx/default.conf;
include rewrite/wordpress.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*.php$ { deny all; }
include enable-php-pathinfo.conf;
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 12h;
}
access_log off;
}
llmwxt 大佬有话说 :
wa,好长,18CM差不多了
可惜一点不懂!!
帮顶,等技术大佬们!
:time::time::time:
Vickers 大佬有话说 :
llmwxt 大佬有话说 : 2020-9-21 10:07
wa,好长,18CM差不多了
可惜一点不懂!!
大佬,咋哪都有你。无处不在:lol
llmwxt 大佬有话说 :
Vickers 大佬有话说 : 2020-9-21 10:22
大佬,咋哪都有你。无处不在
嘿嘿,我闲人啊!
tangwd 大佬有话说 :
不懂技术,帮顶
胖虎 大佬有话说 :
我拿自己博客试了试跳404 ,lnmp1.6
iks 大佬有话说 :
伪静态,转发到index后被补齐的,字数补丁
cyclists 大佬有话说 :
iks 大佬有话说 : 2020-9-21 11:18
伪静态,转发到index后被补齐的,字数补丁
咋搞,大佬
malaohu 大佬有话说 :
include rewrite/wordpress.conf;
这个里面是啥
cyclists 大佬有话说 :
malaohu 大佬有话说 : 2020-9-21 18:40
这个里面是啥
为静态文件
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;