Original address: Nginx cannot parse the PHP solution
0x00: Problem description
When you access the *.php file, the contents of the file are not displayed, but the files you want to access are downloaded directly, such as index.php.
0x01: Solutions
:: Find nginx configuration file, modify file to support PHP
Profile location under:/etc/nginx/sites_available/If you have not created any other configuration files, there should be a default profile named "Default".
1. Open the configuration file to find the following contents in the file:
Location ~ \.php$ {
fastcgi_split_path_info ^ (. +\.php) (/.+) $;
# note:you should have "cgi.fix_pathinfo = 0;" In php.ini
# with php5-cgi alone:
# Fastcgi_pass 127.0.0.1:9000;
# with php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
Fastcgi_index index.php;
Include Fastcgi_params;
}
2. If you find that the above content is commented out, then remove the corresponding comments.
3. Restart Nginx to access the page.
sudo service nginx restart
4. If 503 errors occur again, please install PHP5-FPM and visit again
sudo apt-get install PHP5-FPM