Home > Operation and Maintenance > Nginx > How to solve nginx cannot run php file or directory

How to solve nginx cannot run php file or directory

王林
Release: 2023-05-16 12:58:17
forward
2200 people have browsed it

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 start
netstat -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

How to solve nginx cannot run php file or directory

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

How to solve nginx cannot run php file or directory

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template