Reputation: 373
502 Bad gateway error. Error log and nginx configure are as follows. Anything wrong with that?
[error] 7660#0: *10 connect() failed (111: Connection refused) while connecting to upstream, client: 40.83.126.181, server: 127.0.0.1, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.mysite.com"
nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
http{
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name 127.0.0.1;
location / {
root /www;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
include vhost/*.conf;
}
vhosts/home.conf:
server {
listen 80;
server_name www.mysite.com
#charset utf-8;
access_log /www/host.access.log;
error_log /www/error.log;
root /www;
index index.php index.html index.htm;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 100d;
}
location ~ .*\.(js|css)?$ {
expires 30d;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php(/|$) {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
Upvotes: 0
Views: 354
Reputation: 373
Run php-fpm and make sure that nginx and php-fpm are under the same user(group),and the problem solved.
Upvotes: 1