安装WordPress后台静态资源返回403报错

Posted 周二也被占用

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装WordPress后台静态资源返回403报错相关的知识,希望对你有一定的参考价值。

安装WordPress时,进入安装页面,前台返回403权限不足的错误:

nginx同样有报错如下

2019/03/17 16:45:44 [error] 14360#0: *35 FastCGI sent in stderr: "Access to the script '/opt/nginx/dist/bpblog/wp-includes/css/buttons.min.css' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 223.166.151.243, server: www.nichuiniu.cn, request: "GET /bpblog/wp-includes/css/buttons.min.css?ver=5.0.3 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.nichuiniu.cn", referrer: "https://www.nichuiniu.cn/bpblog/wp-admin/install.php"
2019/03/17 16:45:44 [error] 14360#0: *36 FastCGI sent in stderr: "Access to the script '/opt/nginx/dist/bpblog/wp-includes/js/jquery/jquery.js' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 223.166.151.243, server: www.nichuiniu.cn, request: "GET /bpblog/wp-includes/js/jquery/jquery.js?ver=1.12.4 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.nichuiniu.cn", referrer: "https://www.nichuiniu.cn/bpblog/wp-admin/install.php"
2019/03/17 16:45:44 [error] 14360#0: *39 FastCGI sent in stderr: "Access to the script '/opt/nginx/dist/bpblog/wp-admin/css/install.min.css' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 140.207.120.100, server: www.nichuiniu.cn, request: "GET /bpblog/wp-admin/css/install.min.css?ver=5.0.3 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.nichuiniu.cn", referrer: "https://www.nichuiniu.cn/bpblog/wp-admin/install.php"
2019/03/17 16:45:44 [error] 14360#0: *41 FastCGI sent in stderr: "Access to the script '/opt/nginx/dist/bpblog/wp-admin/js/language-chooser.min.js' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 223.166.151.243, server: www.nichuiniu.cn, request: "GET /bpblog/wp-admin/js/language-chooser.min.js?ver=5.0.3 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.nichuiniu.cn", referrer: "https://www.nichuiniu.cn/bpblog/wp-admin/install.php"
2019/03/17 16:45:44 [error] 14360#0: *42 FastCGI sent in stderr: "Access to the script '/opt/nginx/dist/bpblog/wp-includes/js/jquery/jquery-migrate.min.js' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 223.166.151.243, server: www.nichuiniu.cn, request: "GET /bpblog/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.nichuiniu.cn", referrer: "https://www.nichuiniu.cn/bpblog/wp-admin/install.php"

检查nginx配置文件:

location /bpblog 
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php index.php;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    

对比腾讯课堂里的配置文件,发现是通过两个location进行配置的,于是修改配置文件如下:

    location /bpblog 
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php index.php;
    
    location ~ .php$ 
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    

修改配置文件后,问题解决!
像这类奇葩报错估计万年难遇到一次!

以上是关于安装WordPress后台静态资源返回403报错的主要内容,如果未能解决你的问题,请参考以下文章

资源变现小程序源码及搭建教程

Wordpress与Discuz

vue跨域请求时报403

elastic beanstalk - 应用程序返回 403 not found 静态文件错误

wordpress安装使用出现404403500502情况以及解决方式

子目录安装中的Wordpress 403禁止错误