阿里云的NGINX云虚拟主机部署wordpress网站,伪静态配置

我在阿里云的云虚拟主机上部署的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
喜欢就支持一下吧
点赞7 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容