Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the centos nginx php error problem

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

The editor will share with you how to solve the problem of centos nginx php errors. I hope you will get something after reading this article. Let's discuss it together.

Solutions to centos nginx php errors: 1. Analyze whether php-fpm is installed. If not, install php-fpm;2, modify the nginx.conf file or default.conf;3, save the file and restart nginx.

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

How to solve the problem of centos nginx php errors?

CentOS6.10 Nginx could not parse the php file

First, the problem description: 1). Premise:

Nginx has been installed and can be accessed

2)。 Question:

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

3)。 Native environment PHP version: # php-vPHP 5.3.3 (cli) (built: Mar 22 2017 12:27:09) Copyright (c) 1997-2010 The PHP GroupZend Engine v2.3.0, Copyright (c) 1998-2010 Zend TechnologiesNginx version: [root@bogon sbin] #. / nginx-vnginx version: nginx/1.11.6 II, solution 1). Analyze whether php-fpm is installed

You can run the command service php-fpm start. If the display is not recognized, it is not installed.

2)。 If php-fpm is not installed

You can execute the installation command: yum install php-fpm and then run the command service php-fpm start

3)。 If php-fpm is already installed and the .php file cannot be parsed

(1)。 Modify the nginx.conf file or default.conf, as shown in the following figure, and modify some of the information. For example, "root" refers to my nginx root directory, which can be configured according to your own situation.

(2)。 Save the file and restart nginx, command: service nginx restart (3). At this point, the browser can access the .php file (if it is not local, please turn off the firewall)

Server {listen 80; server_name app-hpoption-admin-test.azfaster.com; root/ data/wwwroot/blog/public; charset utf-8; location / {index index.php index.html; try_files $uri $uri/ / index.php?$query_string } # location ~ .php ${# fastcgi_pass 127.0.0.1 fastcgi_index index.php; 9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME / var/www/test/public$fastcgi_script_name; # include fastcgi_params #} location ~. *\. (php | php5)? ${# fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_pass 127.0.0.1 php5 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / data/wwwroot/blog/public$fastcgi_script_name; include fastcgi_params } error_page 404 / 404.html; error_page 500502503504 / 50x.html; location = / 50x.html {root html;}} after reading this article, I believe you have a certain understanding of "how to solve the centos nginx php error problem". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report