【发布时间】:2014-02-12 20:07:10
【问题描述】:
我最初的错误是这样的:
nginx configuration for Laravel 4
但是在从多个论坛主题的建议中大量修改 Nginx 配置服务器块后,我要么得到 same 错误,其中显示第一页,但任何使用路由的链接都返回 404,或者我得到一个 502。
/nginx/sites-available/默认:
server {
listen 80;
server_name sub.domain.com;
set $root_path '/usr/share/nginx/html/laravel/public';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
错误日志:
2014/01/22 16:51:12 [错误] 14274#0: *1 connect() 失败 (111: 连接被拒绝)同时连接到上游,客户端: xxx.xxx.xxx.xxx,服务器:,请求:“GET / HTTP/1.1”,上游: “fastcgi://127.0.0.1:9000”,主机:“xxx.xxx.xxx.xxx”
【问题讨论】:
-
你有
/etc/php5/fpm/pools/文件夹吗? -
我有 /etc/php5/fpm/pool.d/www.conf @MohammadAbuShady
-
看看里面有一行写着
listen,你会发现2,但只有1会被取消注释,它是什么意思? -
听 = /var/run/php5-fpm.sock @MohammadAbuShady
标签: php nginx laravel laravel-4