Home > Backend Development > PHP Tutorial > Host nginx is used with docker's PHP

Host nginx is used with docker's PHP

藏色散人
Release: 2023-04-07 20:26:01
forward
3925 people have browsed it

The main difference lies in the local nginx configuration

Because the php-fpm service is provided by docker, then modify the PHP-related content in nginx.

Note:

The directory of the php file in docker is: /var/www/html, and (my) local directory is: /data/www/project name.

Original configuration

root           /data/www/项目名;
location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000; # 或者 docker提供的地址:172.17.0.1:9000;
    fastcgi_index  index.php;
    include        fastcgi_params;
}
Copy after login

Change the root line to:

root /var/www/html/项目名 # 即docker中php加载的项目路径
Copy after login

Test Ok!

The above is the detailed content of Host nginx is used with docker's PHP. 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 Issues
Error restarting nginx
From 1970-01-01 08:00:00
0
0
0
server - Nginx configuration webapp problem
From 1970-01-01 08:00:00
0
0
0
Nginx default.conf problem
From 1970-01-01 08:00:00
0
0
0
centos7 - NGINX exception occurs
From 1970-01-01 08:00:00
0
0
0
nginx load balancing
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template