Skip to content
Advertisement

Nginx on Docker serves only welcome pages

I’m using macOS. I’m working on a Debian image created through Dockerfile. Nginx, php-fpm was installed in Debian image. Then I copied server file to /etc/nginx/sites-available/server and created its symbolic link file in /etc/nginx/sites-enabled/. It also copied srcs/info.php files to /var/www/server/info.php. After starting nginx service, I can access my private IP address 192.168.0.46 and see NGINX’s welcome page. However, when accessing 192.168.0.46/info.php, page opening fails. This is the same when other html files are inserted.

I looked it up on Google and found out that it was an INCLUDE problem of /etc/nginx/nginx.conf, but there was no problem.

The first question I suspected was the firewall, but if it was the problem, shouldn’t I not be able to see the welcome page of Nginx? I’ve been thinking and searching all day, but I couldn’t get an answer. Please help me!

Here is my files:

Dockerfile :

JavaScript

server.sites-available :

JavaScript

info.php :

JavaScript

nginx.conf :

JavaScript

Here is my commands:

JavaScript

Advertisement

Answer

use docker run -it -p 80:80 --rm --name server_container server_image to fix it. But I don’t know why…

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement