Error 502 Bad Gateway on nginx
mmpl
nginx-forum at forum.nginx.org
Mon Oct 7 06:07:52 UTC 2019
Error 502 Bad Gateway on nginx and php-fpm
Posted by: mmpl
I can't start php7-fpm in supervisor. The error log:
unable to bind listening socket for address '127.0.0.1:9000': Address in >
use (98)
In browser:
localhost:8090 is error: 502 Bad Gateway
netstat -tulnp
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 13/nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13/nginx
tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 13/nginx
tcp 0 0 :::3000 :::* LISTEN 11/node
tcp 0 0 :::7000 :::* LISTEN 10/node
ps aux
/ # ps aux
PID USER TIME COMMAND
1 root 0:00 {bootloader} /bin/sh /boot/bootloader
8 root 0:01 {supervisord} /usr/bin/python2 /usr/bin/supervisord
62 root 0:00 /bin/sh
92 root 0:00 nginx: master process /usr/sbin/nginx
93 root 0:00 nginx: worker process
94 root 0:00 nginx: worker process
122 root 0:00 ps aux
php-fpm.d/www/conf
[www]
user = nobody
group = nobody
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
/etc/nginx/sites-enabled/page1
server {
listen 8090;
root /usr/bin;
server_name localhost;
access_log /dev/null;
error_log /dev/null;
location / {
proxy_pass http://127.0.0.0:7000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Fowarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
try_files $uri $uri/ =404;
}
location ~ \.(gif) {
root /var/lib;
}
}
/etc/nginx/sites-enabled/page2
server {
server_name localhost;
root /www;
index index.php;
access_log /dev/null;
error_log /dev/null;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php$query_string;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
}
Where is error? I don't just any idea.
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285807,285807#msg-285807
More information about the nginx
mailing list