Home > Backend Development > PHP Problem > What container does php use?

What container does php use?

藏色散人
Release: 2023-02-28 12:10:02
Original
3257 people have browsed it

What container does php use?

docker installation php container

Preface: Continuing from the previous article Installing nginx container

1 . Pull the php image, I pulled the 7.2.9 version of php

docker pull php:7.2.9-fpm
Copy after login

2. Create a php container

docker run -p 9000:9000 --name  php729 -v $PWD/www:/www -v $PWD/php/conf:/usr/local/etc/php -v $PWD/php/conf/conf.d:/usr/local/etc/php/conf.d -v $PWD/php/logs:/phplogs   -d  php:7.2.9-fpm
Copy after login

 -v $PWD/www:/www The directory here and above The www directory where nginx is located in the article is the same

-v $PWD/php/conf:/usr/local/etc/php I don’t know what the use of mounting this directory is, so I’ll copy someone else’s first

3. In this way, the php container is created. Next, check the container IP and configure it in the *.conf file of nginx.

docker inspect php729 |grep "IPAddress"
Copy after login

Open the conf file in nginx. Here is The test.conf file in the previous article

location ~ \.php$ {
    fastcgi_pass <strong>172.0.0.1</strong>:9000; #<strong>将此处的127.0.0.1替换成你刚查出来的ip</strong>
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}
Copy after login

After completion, restart the nginx container, and then access the test file on the page to succeed.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of What container does php use?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template