Home  >  Article  >  Backend Development  >  macos - How to start docker php-fpm?

macos - How to start docker php-fpm?

WBOY
WBOYOriginal
2016-08-04 09:20:421256browse

The Dockerfile is this one: https://github.com/docker-library/php/blob/f016f5dc420e7d360f7381eb014ac6697e247e11/7.0/fpm/alpine/Dockerfile

Execute after building
sudo docker run -d -p 9000:9000 --name php7-fpm daocloud.io/xxx/php7-fpm-alpine:first

daocloud.io/xxx/php7-fpm-alpine:first is the built image

Then sudo docker ps shows that this scene is running

I have nginx locally and restart it.
Turn off the local php-fpm and execute the above startup container command to access the php file.
No 502 error is reported, but the error File not found.

The system is mac, what is the problem? I also tried hanging on -v, which is the command
sudo docker run -d -p 9000:9000 -v /usr/local/www:/var/www/html --name php7-fpm daocloud.io/xxx/php7-fpm-alpine:first

/usr/local/www is my local nginx access directory

Reply content:

The Dockerfile is this one: https://github.com/docker-library/php/blob/f016f5dc420e7d360f7381eb014ac6697e247e11/7.0/fpm/alpine/Dockerfile

Execute after building

sudo docker run -d -p 9000:9000 --name php7-fpm daocloud.io/xxx/php7-fpm-alpine:first

daocloud.io/xxx/php7-fpm-alpine:first is the built image

Then sudo docker ps shows that this scene is running

I have nginx locally and restart it.

Turn off the local php-fpm and execute the above startup container command to access the php file.
No 502 error is reported, but the error File not found.

The system is mac, what is the problem? I also tried hanging on -v, which is the command

sudo docker run -d -p 9000:9000 -v /usr/local/www:/var/www/html --name php7-fpm daocloud.io/xxx/php7-fpm-alpine:first

/usr/local/www is my local nginx access directory

Hello, the www directory must also be mapped into the php-fpm instance. Because of the fpm method, what nginx passes to php-fpm is only a Request object, which does not contain the php file.

So you need to map the www directory to the php-fpm instance .

Well,

You need to ensure that the path seen by Nginx must be the same as the path seen by php-fpm. Because Nginx passes the path to php-fpm.

I have skipped this pit. How to get out of it: Find your php-fpm.conf, check the error_log path configured in it, find this error_log, and you will see the error that .php cannot be found.

Statement:
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