After installing nginx, I found that I could not parse the PHP code. Now the solution is as follows Method 1Find the nginx configuration file and add it as shown below (pictured in the screenshot). My configuration file location is /etc/nginx/sites-available/default location ~ \.php$ { } After modifying the nginx configuration file, restart nginx to take effect /etc/init.d/nginx restart Method 2Implementation of nginx+php+fpm Install php7.4-fpm sudo apt-get install php7.4-fpm Check whether php-fpm is enabled ps -ef | grep php Find php7.4-fpm.sock Go back to the root directory and execute find ./ -name php7.4-fpm.sock Find the location of php7.4-fpm.sock. The following directory shows the location of php7.4-fpm.sock. We copy the location of php7.4-fpm.sock and modify the nginx configuration file. /run/php/php7.4-fpm.sock Configure the following screenshot unix:php7.4-fpm.sock path location fastcgi_pass unix:/run/php/php7.4-fpm.sock; After modifying the nginx configuration file, restart nginx to take effect /etc/init.d/nginx restart Restart or start php7.4-fpm as follows /etc/init.d/php7.4-fpm restart /etc/init.d/php7.4-fpm start This is the end of this article about how to solve the problem that nginx cannot parse PHP after installation. For more related content about nginx cannot parse PHP, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: N ways to center elements with CSS
>>: Summary of JavaScript Timer Types
Official documentation: https://dev.mysql.com/doc...
Table of contents 1. Help Command 2. Mirror comma...
Table of contents 1. Create objects by literal va...
Switching files is a common operation in Linux. W...
Preface Today, a developer gave me feedback that ...
Preface: When we are making web pages, we often n...
Table of contents 1. Embed CSS styles directly in...
Take MySQL 5.7.19 installation as an example, fir...
Why do you need to learn CSS overflow mechanism i...
Table of contents 1. Database design 2. Front-end...
When installing nginx, mysql, tomcat and other se...
Table of contents uni-app Introduction HTML part ...
Let me summarize a problem that I have encountere...
The 404 problem occurs in the Tomcat test. The pr...
Environment Preparation Docker environment MySQL ...