我在阿里云的云虚拟主机上部署的wordpress网站,选用了nginx引擎作为web服务器。部署完成后发现文章页面无法访问,后来发现是使用了伪静态的原因,我选用的伪静态为www.aaa.com/static/p_postid.html。遂对nginx进行了配置:
null
location / {
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
}
}
location ~ /\.ht {
deny all;
}
文章页面可以正常访问了。但登录wordpress后台后,wp-admin下的子目录都无法访问了。搜索资料,建议在nginx里添加
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
我添加完后,仍旧无法访问。
后来在阿里云提交工单,技术员给的建议里有一条:恢复nginx默认设置:
location / {
}
我照搬后,又把原来自己的配置重新复制进去,然后问题奇迹般的消失了。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容