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

Detailed explanation of the configuration method of thinkPHP5 running on nginx

little bottle
Release: 2023-04-06 07:42:02
forward
4205 people have browsed it

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/";
Copy after login

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/";
Copy after login

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

Modify it to:


open_basedir=/home/wwwroot/kilts/public:/tmp/:/proc/
Copy after login

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!

Related labels:
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
Latest Articles by Author
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template