Home>Article>Backend Development> Host nginx is used with docker's PHP
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; }
Change the root line to:
root /var/www/html/项目名 # 即docker中php加载的项目路径
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!