LNMP One-click installation package Nginx 502 Bad Gateway error possible causes and solutions

Source: Internet
Author: User
Tags fpm log log
The first reason: Install LNMP a key installation package when PHP did not install successfully and 502 bad Gateway, starting from 0.9 as long as the installation of success or failure will be prompted. Failure to install the general reason is that before the installation of PHP, some LIB packages in the script may not be installed, causing PHP failed to compile the installation successfully. You can see if there is a/usr/local/php/sbin/php-fpm, if it's not sure it wasn't installed successfully.
Workaround:
You can try installing it manually according to the script in the LNMP one-click installation package to see what the error is causing, search the web, or send the error message. If you do not provide press http://lnmp.org/install.html this installation of the Lnmp.log log file (you can use WINSCP login to download Lnmp.log, compressed and uploaded to this forum), there is no error message we can't say what reason. This method is limited to LNMP not installed successfully, as long as the LNMP installation is successful this item is not possible.

Second reason:
In php.ini, eaccelerator configuration items must be placed before Zend optimizer configuration, or it may cause 502 bad Gateway

Third reason:
There are 502 problems with the installation process, typically because the default php-cgi process is 5, which can result in 502 due to insufficient phpcgi processes and needs to be modified/usr/local/php/etc/php-fpm.conf Max_ The children value is increased appropriately, and if PHP has been upgraded to 5.3.* and using dynamic mode, the value of the Pm.max_spare_servers parameter needs to be adjusted.
It is also possible that the max_requests value is not enough.

Fourth reason:
PHP execution Timeout, modify/usr/local/php/etc/php.ini change max_execution_time to 300 or greater value modify/usr/local/php/etc/php-fpm.conf adjustment request_ Value of Terminate_timeout
Then/etc/init.d/php-fpm restart reboot.

Fifth reason:
Insufficient disk space, such as the MySQL log takes up a lot of space to clean up the files on the disk, there is part of the remaining space, restart can be restored.

Sixth reason:
To see if the php-cgi or PHP-FPM process is running

Seventh Reason:
Will be in the nginx.conf
Fastcgi_connect_timeout
Fastcgi_send_timeout
Fastcgi_read_timeout all up a bit.

Eighth possible cause: http://bbs.vpser.net/thread-1654-1-1.html

Nine, can also try to change the UNIX socket to TCP/IP, modify/usr/local/php/etc/php-fpm.cnf set <value name= "Listen_address" >/tmp/ Nginx.socket</value> changed into <value name= "listen_address" >127.0.0.1:9000</value>, while/usr/local/nginx/ Conf/nginx.conf and its/usr/local/nginx/conf/vhost/under the virtual host configuration in the Fastcgi_pass unix:/tmp/php-cgi.sock;  Replaced by Fastcgi_pass 127.0.0.1:9000; Then reboot and try again.


Ten, if the virtual host log file is too large may cause 502 problems.
It is recommended that you periodically empty the log files for the virtual host.

Xi. Some programs or programs that have a dead loop or other very resource-intensive code can also cause 502, trying to temporarily comment out the possible host's configuration file and restart to see if it will still be 502.

12, if the above methods have tried, but also sometimes appear 502 errors, you can try to add 502 automatic restart script: http://bbs.vpser.net/thread-1913-1-1.html

13, really can not find the reason to open slowlog to see whether there is a slow log of useful information: http://bbs.vpser.net/viewthread.php?tid=10251&page=1&fromuid=3# pid30582

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.