Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution that nginx can't parse php files

Shulou Source: shulou.com Published: 2022-06-03 16:25:47 11月14日 Update

Editor to share with you the solution that nginx can not parse php files, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Nginx can not parse php file solutions: 1, install nginx;2, configure nginx.conf file content as "unix:/run/php-fpm/php-fpm.sock..."; 3, restart nginx.

This article operating environment: linux5.9.8 system, PHP7.1 version, DELL G3 computer

What if nginx cannot parse the php file?

Nginx cannot parse php file under linux

1. Premise

Nginx has been installed and has access to html files

2. Problems

Download by default when accessing a .php file, or prompt "File not found."

3. Solution

Configure the nginx.conf file

Location ~\ .php$ {root / mnt/wind/www; # Root directory is configured correctly fastcgi_pass unix:/run/php-fpm/php-fpm.sock; # is the same as php-fpm 's listening port fastcgi_index index.php Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}

Restart nginx again.

These are all the contents of this article entitled "nginx can't parse php files". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: File content article configuration method not much premise method most what to do solution more root directory environment computer knowledge port system industry solution Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Apple Xiaomi MySQL