When using nginx, nginx always encounters a 500 error. However, you need to go to the background to check the error-log.
When using nginx, nginx always encounters a 500 error. However, you need to go to the background to check the error-log, which is inconvenient.
I would like to introduce a small method for you. it is very useful when debugging php, but it is not recommended to enable this function on the online server.
First, enable the error message prompt function of php.
Vim/etc/php5/fpm/php. ini
Open error prompt
Display_errors = On
Because the four fpm used with nginx, so also need to modify the php-fpm.conf file
Vim/etc/php5/fpm/php-fpm.conf
Add
Php_flag [display_errors] = on
Someone asked, this parameter does not exist in php-fpm. Yes, you cannot find it in it.
You need to find the configuration parameters in another path. For more information, see php-fpm configuration.
Vim/etc/php5/fpm/pool. d/www. conf
In fact, it doesn't matter if you don't look for it. just paste it directly, and then read the nginx configuration again.
Sudo service nginx reload
Modify a php error at will, and refresh the page to see the familiar error message.