How to change nginx's default homepage via a Dockerfile and then launch it by running a container
The default nginx config will load the index.html
file from the /usr/share/nginx/html
directory.
This default is set in /etc/nginx/conf.d/default.conf
with the lines
location / { root /usr/share/nginx/html; index index.html index.htm;}
So to fix this you can copy welcome.html
into the /usr/share/nginx/html
directory as index.html
, or change the above index
line to reference welcome.html
and reload. To make this change more permanent you would likely want to create a dockerfile that defines a docker image overriding the config copied in where you have already set this value.
Alternatively you should just be able to access /welcome.html
when hitting your server e.g. http://localhost:80/welcome.html