TrafeX / docker-php-nginx

Docker image with PHP-FPM 8.3 & Nginx 1.24 on Alpine Linux
https://hub.docker.com/r/trafex/php-nginx
MIT License
1.33k stars 721 forks source link

when starting the docker file i am getting NGINX welcome page instead of phpinfo page as mentioned in readme. #141

Closed Prakash4844 closed 10 months ago

Prakash4844 commented 10 months ago

Readme mentions:

Start the Docker container:

docker run -p 80:8080 trafex/php-nginx

See the PHP info on http://localhost/, or the static html page on http://localhost/test.html


but i am getting the nginx welcome page when starting the container

here's nginx output:

─[zaphkiel@Kurumi:~]─[11:59:23 AM IST]
╰─>$ docker run -p 80:8080 trafex/php-nginx
2023-08-25 06:29:39,057 INFO supervisord started with pid 1
2023-08-25 06:29:40,060 INFO spawned: 'nginx' with pid 6
2023-08-25 06:29:40,062 INFO spawned: 'php-fpm' with pid 7
[25-Aug-2023 06:29:40] NOTICE: fpm is running, pid 7
[25-Aug-2023 06:29:40] NOTICE: ready to handle connections
2023-08-25 06:29:41,107 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-08-25 06:29:41,107 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
172.17.0.1 - - [25/Aug/2023:06:29:44 +0000] "GET / HTTP/1.1" 499 0 "-" "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/116.0" "-" 0.001 0.001 . -
2023/08/25 06:29:44 [error] 9#9: *3 open() "/var/www/html/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: "http://localhost/"
172.17.0.1 - - [25/Aug/2023:06:29:44 +0000] "GET /favicon.ico HTTP/1.1" 404 118 "http://localhost/" "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/116.0" "-" 0.000 - . -
172.17.0.1 - - [25/Aug/2023:06:29:49 +0000] "GET /test.html HTTP/1.1" 200 70 "-" "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/116.0" "-" 0.000 - . -
172.17.0.1 - - [25/Aug/2023:06:29:50 +0000] "GET /favicon.ico HTTP/1.1" 404 118 "http://localhost/test.html" "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/116.0" "-" 0.000 - . -
2023/08/25 06:29:50 [error] 8#8: *4 open() "/var/www/html/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: "http://localhost/test.html"
172.17.0.1 - - [25/Aug/2023:06:30:13 +0000] "GET / HTTP/1.1" 200 24563 "-" "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/116.0" "-" 0.003 0.003 . -
172.17.0.1 - - [25/Aug/2023:06:30:13 +0000] "GET /favicon.ico HTTP/1.1" 404 118 "http://localhost/" "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/116.0" "-" 0.000 - . -
2023/08/25 06:30:13 [error] 8#8: *7 open() "/var/www/html/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: "http://localhost/"
Prakash4844 commented 10 months ago

okay, so i found the problem, Even when running with -p 80:8080 it shows nginx welcome screen.

so i investigated and ran docker port [container id] which provided output as:

╰─>$ docker port 0869652af579
8080/tcp -> 0.0.0.0:80
8080/tcp -> [::]:80

so when i access the 0.0.0.0:80 in browser i got proper phpinfo() page.

don't know if this is supposed to happen as readme explicitly mention localhost

Prakash4844 commented 10 months ago

upon closer inspection, i see that default.conf listens to port 8080 and Dockerfile exposes Port 8080.