gpt4 book ai didi

php - 奇怪的网络服务器问题

转载 作者:太空宇宙 更新时间:2023-11-04 04:17:29 25 4
gpt4 key购买 nike

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

已安装基于on this tutorial

这是网站的 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;
}

}

顺便说一句,这个配置是 optimized for Yii framework

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

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-ed 递归整个父目录,即网站所在的位置。

我不知道可能出现什么问题。请帮我解决这个问题。我可以向任何想要提供帮助的人提供远程访问权限。

注意

出于信心,我刚刚用此 path_to_website 替换了真实路径。就这样。存在真实路径

最佳答案

 set $host_path "path_to_website";

您需要定义您的网站路径:

即:/var/www/

  1. 打开终端

  2. 列表项

  3. cd 进入 www 目录的根目录
  4. 输入“pwd”,无论结果如何
  5. 将其输入 $host_path

关于php - 奇怪的网络服务器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15578576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com