Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


502 bad gateway nginx and minstall!
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

502 bad gateway nginx and minstall!

Hello!

I have a Debian vps with minstall installed on it (nginx, php, mysql).
When i did a upgrade on my minstall installation yesterday,
i got the message "502 Bad Gateway" when i visited one of my wordpress websites hosted on the vps using minstall.

Please help me with this error!

Thanks in advance!

Comments

  • ProfforgProfforg Member
    edited September 2014

    If you are fine with payed help - welcome to private messaging :)

    It's crazy to ask help for every question about Linux at LET. It's not support board. If you want your websites to work, hire sysadmin.

  • Try chmod 666 /var/run/php5-fpm.sock

  • @introducial said:
    Try chmod 666 /var/run/php5-fpm.sock

    I tried it but i got the following error:
    chmod: cannot access/var/run/php5-fpm.sock': No such file or directory`

  • @Profforg said:
    It's crazy to ask help for every question about Linux at LET. It's not support board. If you want your websites to work, hire sysadmin.

    LET is a community forum used by industry professionals, hobbyists, and complete newbs. People are more than welcome to ask questions about things they're not knowledgeable on - he's not asking for us to move mountains for him.

    Give this guy a break, it's his first post. :)

  • rokokrokok Member
    edited September 2014

    if you need help, provide more details

    tail /var/log/nginx/error.log

  • @joca91 said:
    chmod: cannot access/var/run/php5-fpm.sock': No such file or directory`

    What does listen and listen.mode directives look like in /etc/php5/fpm/pool.d/www.conf? I'm suspecting of a file permission issue however it can be another thing too, error log would also help.

  • @rokok said:
    if you need help, provide more details

    tail /var/log/nginx/error.log

    my error.log file in /var/log/nginx/ is empty :(

  • @introducial said:
    What does listen and listen.mode directives look like in /etc/php5/fpm/pool.d/www.conf? I'm suspecting of a file permission issue however it can be another thing too, error log would also help.

    There is no www.conf file in the directory: /etc/php5/fpm/pool.d/www.conf.
    But is two another .conf filesthere, here is them in full:

    johan.conf:

    `[johan]
    listen = /home/johan/http/private/php.socket

    user = johan
    group = johan
    pm = ondemand
    pm.max_children = 4
    pm.max_requests = 500
    php_flag[expose_php] = off
    php_value[max_execution_time] = 120
    php_value[memory_limit] = 64M
    `

    www-data.conf:

    [www-data] listen = /dev/shm/php.socket user = www-data group = www-data pm = ondemand pm.max_children = 4 pm.max_requests = 500 php_flag[expose_php] = off php_value[max_execution_time] = 120 php_value[memory_limit] = 64M

  • Well, then try chmod 666 /home/johan/http/private/php.socket and chmod 666 /dev/shm/php.socket

  • @introducial said:
    Well, then try chmod 666 /home/johan/http/private/php.socket and chmod 666 /dev/shm/php.socket

    Thanks! that help me out! now everything working and running again!

  • Incase you have problem in the future after updating the nginx and php, try to change the php pool config for example :

    user = johan
    group = johan
    listen.owner = johan
    listen.group = johan
    
    Thanked by 1Ndha
  • You can also use ports, no permission issues there.

  • mikhomikho Member, Host Rep
    edited September 2014

    Chmod the socket file will only work until you reboot the server.
    Then it will go back to 502 bad gateway again.

    The bug reports from nginx suggests another solution, even if its not a correct solution in a multi user environment like minstall or tuxlite provides.

    The solution is to change the user and group parameters to nginx or www-data depending on your installation.
    Don't forget to restart php and nginx to actually see the changes you made.

    This "survives" a reboot.
    Another solution is to use ports instead of sockets. However some claim that it is slower then using sockets.

  • Try add 'listen.mode = 0666' under '[www-data]'

  • something wrong between php and nginx. check php config

  • @black said:
    You can also use ports, no permission issues there.

    Speed and security penalty.

  • @ErawanArifNugroho said:
    Incase you have problem in the future after updating the nginx and php, try to change the php pool config for example :

    > user = johan
    > group = johan
    > listen.owner = johan
    > listen.group = johan
    > 

    Thanks! i will try it!

Sign In or Register to comment.