403试图访问我的简单testing页时禁止

我刚刚安装了nginx,我试图设置我的第一个网站。 我试图用php-fpm来使用nginx。 nginx安装(当我去我的IP我得到默认的欢迎页面)。

现在我正试图获得一个简单的脚本运行:

<?php phpinfo(); 

但我一直打403页禁止页面。 在我的虚拟主机的日志中,我可以看到很多行:

 2012/05/18 01:29:45 [error] 4272#0: *1 access forbidden by rule, client: x.170.147.49, server: example.com, request: "GET / HTTP/1.1", host: "example.com" 

该文件是/srv/www/test/index.php其中nginx是所有者(我去了包括文件的完整path无效)。

我已经检查了nginx确实在configuration中运行在用户和组nginx/nginx下。 在nginx.conf中,我已经改变了默认configuration包含path,以确保没有其他configuration( include /etc/nginx/sites-enabled/ )。

我正在使用的configuration看起来像(如果您需要其他configuration(php-fpm / nginx.conf),请让我知道):

 server { listen 80; server_name example.com; root /srv/www/test; access_log /var/log/nginx/example-access.log; error_log /var/log/nginx/example-error.log error; location ~ /. { access_log off; log_not_found off; deny all; } location ~ ~$ { access_log off; log_not_found off; deny all; } location ~* .(js|css|png|jpg|jpeg|gif|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc)$ { add_header Pragma "public"; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; access_log off; log_not_found off; expires 360d; } location ~ /.ht { deny all; access_log off; log_not_found off; } location ~ /. { access_log off; log_not_found off; deny all; } location ~ ^/(index|frontend_dev|admin|staging).php($|/) { #rewrite ^/(.*)/$ /$1 permanent; fastcgi_split_path_info ^(.+.php)(.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } location / { index index.php; try_files $uri /index.php?$args; } } 

你的configuration是故意阻止它:

 location ~ /. { access_log off; log_not_found off; deny all; } 

这将匹配斜线后面跟着任何types的字符的任何请求; 的. 正则expression式中的字符表示“任何字符”。

我假设你打算检查文字. ; 这将是这个configuration:

 location ~ /\. { 

让我知道如果不是这样的话!