Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 403 Wordpress站点的Nginx配置中存在禁止的错误_Php_Wordpress_Nginx_Webserver - Fatal编程技术网

Php 403 Wordpress站点的Nginx配置中存在禁止的错误

Php 403 Wordpress站点的Nginx配置中存在禁止的错误,php,wordpress,nginx,webserver,Php,Wordpress,Nginx,Webserver,我正在为Wordpress配置一个Nginx站点,出现以下错误: 2014/11/21 16:39:24[错误]38741#0:*2目录索引 “/var/www/html/jurisprudencialaboral.dev/”被禁止,客户端: 192.168.3.1,服务器:jurisprudencialaboral.dev,请求:“GET/HTTP/1.1”,主机:“jurisprudencialaboral.dev” 以下是分配给该目录的权限: drwxr-xr-x 5 apache ro

我正在为Wordpress配置一个Nginx站点,出现以下错误:

2014/11/21 16:39:24[错误]38741#0:*2目录索引 “/var/www/html/jurisprudencialaboral.dev/”被禁止,客户端: 192.168.3.1,服务器:jurisprudencialaboral.dev,请求:“GET/HTTP/1.1”,主机:“jurisprudencialaboral.dev”

以下是分配给该目录的权限:

drwxr-xr-x  5 apache root 4096 Nov 21 16:28 jurisprudencialaboral.dev
这是
jurisprudencia.dev
服务器内容文件:

server {
       server_name jurisprudencialaboral.dev jurisprudencia jurisprudencialaboral;
       root /var/www/html/jurisprudencialaboral.dev;

        location / {
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass  127.0.0.1:9000;
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                #fastcgi_param SCRIPT_FILENAME /var/www/html/jurisprudencialaboral.dev$fastcgi_script_name;
        }

        access_log /var/log/nginx/jurisprudencialaboral.dev/access.log;
        error_log /var/log/nginx/jurisprudencialaboral.dev/error.log;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
        # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
        location ~ /\. {
                deny all;
        }

        # Deny access to any files with a .php extension in the uploads directory
        # Works in sub-directory installs and also in multisite network
        # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
        location ~* /(?:uploads|files)/.*\.php$ {
                deny all;
        }

        # Add trailing slash to */wp-admin requests.
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

 # Directives to send expires headers and turn off 404 error logging.
        location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
               access_log off; log_not_found off; expires max;
        }

        # Uncomment one of the lines below for the appropriate caching plugin (if used).
        #include global/wordpress-wp-super-cache.conf;
        #include global/wordpress-w3-total-cache.conf;
}

我是从,我做错了什么?为什么会出现403错误?

这一点很清楚。您请求URI
/
,因此nginx尝试列出docroot内容,但as
autoindex
指令的默认值为false,因此不允许此操作,nginx返回适当的HTTP
403


您忘记设置
index
指令来提供索引文件。

谢谢,还有一个问题,为什么不登录错误?我可以看到上一个,但新的没有被记录。例如,现在站点不工作,我怀疑与DB有关,但我一点也不清楚,因为日志仍然是空的,为什么?@ReynierPM你说的是哪一个日志?这一个
error\u log/var/log/nginx/jurisprudencialaboral.dev/error.log
文件只包含这样的错误
2014/11/21 16:49:25[错误]38741#0:*4目录索引“/var/www/html/jurisprudencialaboral.dev/”被禁止,客户端:192.168.3.1,服务器:jurisprudencialaboral.dev,请求:“GET/HTTP/1.1”,主机:“jurisprudencialaboral.dev”
但现在我得到了一个空白页,需要找到导致该问题的原因,但没有错误。我如何知道?@ReynierPM如果nginx.log中没有错误,那么nginx没有运行或者根本没有错误。检查php fpm端发生了什么。嗯,这很奇怪,我在另一个网站的Symfony2下工作,它在Nginx和php-fpm上运行,所以Nginx已经在运行了,不管怎样,我会在php-fpm端检查什么?