How to configure php-fpm in lnmp-linux (centos7 + nginx + mysql + php5.6)

Source: Internet
Author: User
In linux (centos7 + nginx + mysql + php5.6), how does one configure php-fpm? After I run ps-ef | grepphp-fpm, it is displayed as shown in. This should be wrong, right? My nginx configuration is as follows. However, an error was reported during the access. 502. Which of the following experts can explain how I can debug it now...

In linux (centos7 + nginx + mysql + php5.6), how does one configure php-fpm?
After I run ps-ef | grep php-fpm, it is displayed as shown in.


This should be wrong, right?
My nginx configuration is as follows.

However, an error is reported during access. 502,

Which of the following experts can explain how to debug and correct the errors.

Reply content:

In linux (centos7 + nginx + mysql + php5.6), how does one configure php-fpm?
After I run ps-ef | grep php-fpm, it is displayed as shown in.


This should be wrong, right?
My nginx configuration is as follows.

However, an error is reported during access. 502,

Which of the following experts can explain how to debug and correct the errors.

I don't know much about it either, but you mentioned that the php-fpm configuration may be wrong. It provides a clue that your configuration file uses the unixsock method to connect to php-fpm, check whether the configuration file of php-fpm is set to listen to unixsock? You can take a look at the php-fpm.conf listen, I usually use listening to tcp port 9000

You need to check the log, In the var/log php-fpm or nginx

The default php-fpm.conf is:
listen = 127.0.0.1:9000
Corresponding:
fastcgi_pass 127.0.0.1:9000;
And now you are
fastcgi_pass unix:/var/run/php5-fpm.sock;
So the php-fpm.conf should correspond:
listen = /var/run/php5-fpm.sock

Also, when there is a problem with the configuration service, you should first check the error message in the log.

Does lz seem to use the laravel framework? You can try to create a PHP file in the public folder to check whether the file can be accessed normally.

Delete the last location to replace sock with 127.0.0.1: 9000. 502 is returned when a cgi call fails to be executed.

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.