Welcome! Log In Create A New Profile

Advanced

502 Bad Gateway

Posted by captexaj 
502 Bad Gateway
May 14, 2012 06:29PM
Hi, When I attempt to access my Wordpress site, I keep getting NGINX Bad
Gateway errors. I looked in the NGINX error logs and there were no
entries, so after I performed some more research, I found out that
this could be a php-fpm issue, so I looked in the log and sure enough
when I went to my php5-fpm.log file, I saw this:

[14-May-2012 16:39:46] ERROR: unable to bind listening socket for
address '127.0.0.1:9000': Address already in use (98)
[14-May-2012 16:39:46] ERROR: FPM initialization failed

Any ideas on this one? I've already reviewed most of the forum discussions on this and have not had any success with fixing this.

Just a standard NGINX stack install on Ubuntu 10.04 to run Wordpress and Big Blue Button.
Re: 502 Bad Gateway
May 15, 2012 06:31AM
You have more then 1 nginx/php process running, kill them all and restart.
Re: 502 Bad Gateway
May 15, 2012 08:01PM
yes I rebooted my server and then I was able to access the site. But then I got the error again and can't access any of my site. The only fix i know and is very temporary is rebooting the server.
Re: 502 Bad Gateway
May 15, 2012 08:25PM
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1324/nginx
tcp 0 0 127.0.0.1:8021 0.0.0.0:* LISTEN 944/freeswitch
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1008/sshd
tcp 0 0 127.0.0.1:5090 0.0.0.0:* LISTEN 944/freeswitch
tcp 0 0 127.0.0.1:5060 0.0.0.0:* LISTEN 944/freeswitch
tcp 0 0 127.0.0.1:8100 0.0.0.0:* LISTEN 1028/soffice.bin
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1437/php-fpm.conf)
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 976/mysqld
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 1447/redis-server
tcp6 0 0 :::5070 :::* LISTEN 1679/java
tcp6 0 0 :::1935 :::* LISTEN 1679/java
tcp6 0 0 :::9999 :::* LISTEN 1679/java
tcp6 0 0 :::8080 :::* LISTEN 1519/java
tcp6 0 0 :::22 :::* LISTEN 1008/sshd
tcp6 0 0 :::5080 :::* LISTEN 1679/java
tcp6 0 0 ::1:5090 :::* LISTEN 944/freeswitch
tcp6 0 0 :::9123 :::* LISTEN 1679/java
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 1519/java


And this is my vhost config file for the domain im getting the errors for:

server {

listen 80;
server_name www.cleantechfaq.com;
rewrite ^/(.*) http://cleantechfaq.com/$1 permanent;
}

server {

listen 80;
server_name cleantechfaq.com;

access_log /var/www/cleantechfaq.com/logs/access.log;
error_log /var/www/cleantechfaq.com/logs/error.log;

root /var/www/cleantechfaq.com/public;
index index.php;

location / {
try_files $uri $uri/ @wordpress /index.php?q=$request_uri;
}

location @wordpress {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/cleantechfaq.com/public/index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_NAME /index.php;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri @wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/cleantechfaq.com/public$fastcgi_script_name;
include fastcgi_params;
}
}

and this is default:


# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts

server {
listen 80 default;
server_name localhost;

access_log /var/log/nginx/localhost.access.log;

location / {
root /var/www/nginx-default;
index index.html index.htm;
}

location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}

location /images {
root /usr/share;
autoindex on;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www/nginx-default;
#}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#includefastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#listen 8000;
#listen somename:8080;
#server_name somename alias another.alias;

#location / {
#root html;
#index index.html index.htm;
#}
#}


# HTTPS server
#
#server {
#listen 443;
#server_name localhost;

#ssl on;
#ssl_certificate cert.pem;
#ssl_certificate_key cert.key;

#ssl_session_timeout 5m;

#ssl_protocols SSLv2 SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#ssl_prefer_server_ciphers on;

#location / {
#root html;
#index index.html index.htm;
#}
#}
Re: 502 Bad Gateway
May 18, 2012 02:32PM
Any ideas?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 234
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready