Use the command service nginx start in Linux to start, and log in to localhost to see the welcome page.
During the modification process, I added index.php to the server,
root is still /usr/share/nginx/html, no changes have been made.
When I open localhost, a 502 bad gateway error is reported.
According to what is said on the Internet, I have tested whether the cache is not enough or the threads are not enough. It should not be a problem with php-fpm. I'm wondering if it's because php-fcgi is not started?
I’ll ask myself some questions and tell you my solution.
The answer on the first floor is correct, but starting php-cgi didn't work on my machine for some reason, so I downloaded spwan-fcgi, which is a software for managing php-cgi.
After successful installation, enter the command spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi (the bold words should be modified according to your location. ) after starting.
I still don't know why php-fpm cannot start. . .
php-cgi has not been started yet, it definitely won’t work. The solution is to start php-cgi
PHP-FPM is an independent program that does not depend on PHP-CGI.
The main process of PHP-FPM can manage its own work process, so spwan-fcgi is not needed.
Installation method on Ubuntu/Debian:
For configuration methods, please refer to:
http://huoding.com/2013/10/23/290
PHP under nginx needs to use php-fpm. Add
when compiling php.,
Then you need to create the php-fpm configuration file php-fpm.conf in the etc directory of php (configuration reference: http://qiananhua.com/22#title-4)
Then you can start php-fpm