Solutions to the problem that nginx cannot run php files or directories: 1. Start the php-fpm server; 2. Check the nginx configuration of the website; 3. Open the nginx.conf file and view the root command and fastcgi_param command path; 4. Set the command path to be consistent with the file path to be accessed.
Solve the problem of nginx not parsing php
nginx was successfully installed and ran
php was installed successfully and php-fpm was successfully run: service php-fpm startnetstat -antp | grep :80
netstat -antp | grep :9000
, ports 80 and 9000 are both in listening state
nginx Can access html static files but cannot access php files
The html webpage can run but PHP just can’t run...
1. "Remember to start php-fpm after installation is completed Server "Be sure to start
2. Check the nginx configuration of your website, especially the points marked in the picture
Generally this is the case (I What you encounter is)
In the nginx.conf file, the root directive and fastcgi_param directive are inconsistent with the path of the file you want to access
Note: One point to note here is that the nginx configuration files of each version are somewhat different, but they are generally the same. root refers to the default access path, and fastcgi_aram refers to the path to be parsed by PHP. These two paths need to be consistent. access.
The above is the detailed content of How to solve nginx cannot run php file or directory. For more information, please follow other related articles on the PHP Chinese website!