Nginx + webapps = 502 Bad Gateway

password

Verified User
Joined
Oct 11, 2011
Messages
134
Hello!

I'm running PHP 5.4 (php-fpm) with Nginx. I can't get my webapps to work. I only get "502 Bad Gateway" when i try browsing them.

Ownership of /var/www:
Code:
dr-xr-x--x  9 webapps nginx 4096 Mar 26 17:24 www

/var/www/html:
Code:
drwxr-xr-x  4 root root  4096 May  5 12:23 html

And for roundcube:
Code:
lrwxrwxrwx  1 webapps nginx     19 Apr 17 06:25 roundcube -> roundcubemail-0.9.0
drwxr-xr-x 10 webapps nginx   4096 Apr 17 06:25 roundcubemail-0.9.0

Aliases must be working since i get redirected to /roundcube when i try /webmail. I have also tried browsing them through server IP but this won't work either.
 
Hello,

The error "502 Bad Gateway" here would mean, that the server does not get answer from PHP-FPM within existing time frame. You should check error logs of NGINX as well as any of PHP-FPM.
 
I found this inside the Nginx error log:

Code:
2013/05/08 09:33:19 [crit] 30515#0: *22391 connect() to unix:/usr/local/php54/sockets/webapps.sock failed (13: Permission denied) while connecting to upstream, client: 4.3.2.1, server: XXXXXXXXXXXXXXXXXXXXXX, request: "GET /roundcube/ HTTP/1.1", upstream: "fastcgi://unix:/usr/local/php54/sockets/webapps.sock:", host: "1.2.3.4"

So it's a permission error. What permissions do i need to change?
 
Please check:
Code:
ls -l [COLOR=#333333]/usr/local/php54/sockets/webapps.sock

Try restarting php-fpm54 service (and check the output of "ls -l" again).[/COLOR]
 
Code:
srw-rw---- 1 webapps apache 0 May  8 09:31 /usr/local/php54/sockets/webapps.sock

I guess that should be nginx instead of apache?
 
I did chown webapps:nginx and now it works.

Thank you dude! =)
 
502 Bad Gate Way still don't fixed

hello
i searched a lot in the forum but i couldn't find any solution for my problem..
i'm using DA-CB2.0 and with nginx webserver + phpfpm (php5.5)
after i ./build all everything installed well , and the server is working good now

but one of my domains on the server don't come up and i'v got Error 502 Bad gate way!

i checked these:

/usr/local/php55/sockets/thisuser.sock
this chown thisuser:nginx and chmod 660

i restarted php-fpm55 several time and it started successfully but nothing changed

i read this help but my problem not solved :
http://help.directadmin.com/item.php?id=495

i checked the error log of nginx of this user
the last report is :
2014/01/16 19:18:26 [error] 9131#0: *8786 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 204.187.14.74, server: site.org, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/usr/local/php55/sockets/user.sock:", host: "site.org"


i noticed that i just got error when i enter the home page address
when i enter site.org i see 502 error
but when i enter site.org/apple i can see the page completely !

what should i do ?
 
Last edited:
i found the reason ! but don't know how to solve.

i have a slider for wordpress on my theme!
when i remove this slider the site come up without any error but when i enable the slider again i get 502 error

i didn't have this problem on apache ! how should i fix this ?
 
Last edited:
Back
Top