Home  >  Article  >  Backend Development  >  Detailed explanation of the configuration method of thinkPHP5 running on nginx

Detailed explanation of the configuration method of thinkPHP5 running on nginx

little bottle
little bottleforward
2019-04-20 16:10:443901browse

The following is a brief explanation of the configuration of tp5 running on nginx.

The tp5 project does not support pathinfo by default in nginx, so how do we configure it?

Let’s look at the following problem first. After we configure the domain name according to the normal process, point it to the public directory and restart nginx. When accessing, the path error is reported and 500 appears.

Solution:

In the fastcgi.conf file we will see the following:


##

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";

We only need to modify the path of open_basedir Just do it, modify it as follows:


fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/../:/tmp/:/proc/";

Then check the ".user.ini" file in the public folder of the project:

Modify it to:


open_basedir=/home/wwwroot/kilts/public:/tmp/:/proc/

Then call it nginx, then open the project and it will run normally.

Related tutorials:

PHP video tutorial

The above is the detailed content of Detailed explanation of the configuration method of thinkPHP5 running on nginx. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete