Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.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 奇怪的Web服务器问题_Php_Linux_Ubuntu_Nginx_Webserver - Fatal编程技术网

Php 奇怪的Web服务器问题

Php 奇怪的Web服务器问题,php,linux,ubuntu,nginx,webserver,Php,Linux,Ubuntu,Nginx,Webserver,我的操作系统:Ubuntu 12.10 Web服务器环境为:Nginx+PHP-FPM 基于安装的 这是网站的nginx conf文件 server { set $host_path "path_to_website"; server_name website.local; root $host_path; set $yii_bootstrap "index.php"; charset utf-8; index index.php index.ht

我的操作系统:Ubuntu 12.10 Web服务器环境为:Nginx+PHP-FPM

基于安装的

这是网站的nginx conf文件

server {
set $host_path "path_to_website";

server_name  website.local;

root $host_path;
set $yii_bootstrap "index.php";

charset utf-8;
index index.php index.html;

log_not_found off;

location / {
    index  index.html $yii_bootstrap;
    try_files $uri $uri/ /$yii_bootstrap?$args;
    }

    location ~ ^/(protected|framework|themes/\w+/views) {
    deny  all;
    }

    #avoid processing of calls to unexisting static files by yii
    location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    try_files $uri =404;
}


location ~ \.php$ {
    fastcgi_split_path_info  ^(.+\.php)(.*)$;
    #let yii catch the calls to unexising PHP files
    set $fsn /$yii_bootstrap;
    if (-f $document_root$fastcgi_script_name){
        set $fsn $fastcgi_script_name;
    }
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

location ~ /\.ht {
    deny  all;
}
}

顺便说一句,这个配置是

问题是,当我尝试进入网站时,出现以下错误:

File not found. 
当我打开nginx
error.log
文件时,我看到以下内容

    2013/03/22 23:36:45 [crit] 14388#0: *4 stat() "path_to_website" failed (13: Permission denied), client: 127.0.0.1, server: website.local, request: "GET / HTTP/1.1", host: "website.local"
2013/03/22 23:36:45 [crit] 14388#0: *4 stat() "path_to_website" failed (13: Permission denied), client: 127.0.0.1, server: website.local, request: "GET / HTTP/1.1", host: "website.local"
2013/03/22 23:36:45 [crit] 14388#0: *4 stat() "path_to_websiteindex.php" failed (13: Permission denied), client: 127.0.0.1, server: website.local, request: "GET / HTTP/1.1", host: "website.local"
2013/03/22 23:36:45 [error] 14388#0: *4 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: website.local, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "website.local"
我100%确定网站的路径,并将其添加到主机文件
website.local
。同样,chown-递归地编辑整个父目录,即网站所在的目录

我想不出有什么问题。请帮我解决这个问题。我可以为任何想帮忙的人提供远程访问


我刚刚用这个
path\u to\u网站
替换了真实路径,以增强信心。就这些。这是一条真正的道路

 set $host_path "path_to_website";
您需要定义您的网站路径:

ie:/var/www/

  • 开放式终端

  • 列表项

  • 将cd放入www目录的根目录中
  • 输入“pwd”,无论结果如何
  • 将其输入到$host\u路径中

  • nginx日志文件从不存在。如果它说这是一个“权限被拒绝”的错误,那么它就是。你需要

    • 确保用户www数据(即根据屏幕截图运行nginx的用户)可以读取此文件夹本身的“路径到网站”。尝试此操作的一种方法是在终端中运行此命令:

       sudo -u www-data ls path_to_website
      
    并查看是否拒绝对www数据的许可,或者只是

       ls -la path_to_website
    
    以调查该路径的权限信息

    • 用户www数据可能无法访问“path\u to\u网站”的父文件夹。例如,如果您的网站路径为“/var/www/mysite/”,则www数据可能无法读取“/var”或“/var/www”

    2013/03/22 23:36:45[crit]14388#0:*4 stat()“网站路径”失败(13:权限被拒绝),客户端:127.0.0.1,服务器:website.local,请求:“GET/HTTP/1.1”,主机:“website.local”。。它显示的是path_to_网站,而不是实际位置。我只是用这个
    path_to_网站
    替换了实际路径,以示信任。就这些。如果您确定文件夹+主机信息是正确的,那么folderI给出的命令chmod 755和chown-x递归地从父folderI开始具有什么权限。然后我认为作为deamon运行ngnix进程的用户没有访问权限。返回什么:ps aux | grep“nginx:worker process”为什么设置$fsn但从不使用它?