I have a ugreen 6800 pro which I just got. I have docker images for multiple items, including wordpress, plex, npm, and several others. All works fine. I’m trying to find a way to serve a single static web page (tribute to lost daughter) but I’m having no luck. The nginx docker image in on volume 1 in a folder called nginx.
I create the below stack in Portainer, it runs correctly, but doesn’t respond to anything on 8085. I’m sure my mappings are incorrect, but I’m not sure of the next step. Any assistance would be appreciated.
services:
nginx:
image: lscr.io/linuxserver/nginx:latest
container_name: nginx
environment:
- PUID=1000
- PGID=10
- TZ=Etc/UTC
- NGINX_AUTORELOAD= #optional
- NGINX_AUTORELOAD_WATCHLIST= #optional
volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/nginx/www-data:/var/www # place your files for web here
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/nginx/nginx-conf:/etc/nginx/conf.d # place nginx.conf here
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/nginx/logs:/var/log/nginx
ports:
- 8085:8085
restart: unless-stopped
You have a port mapping from external port 8085 to internal port 8085. But I highly doubt that nginx inside container listens on that port by default, unless explicitly configured. Maybe try 8085:80.
In the container. If that works, check what the container IP is and try the same with IP. docker inspect containername on the host or ip a in the container will show you the IP. If that curl command works too, the port mapping should be correct. And the host should be able to access the website. If it doesn’t work, there is a configuration issue in nginx.
If your port mapping is correct and curl works on the IP but the host cannot access the webserver, then it is something I cannot even guess now.
Note: You don’t need to change the nginx config to make the website available on port 8585, just leave the default port on 80 and do what @bluepuma77 recommended to try as correct portmapping.
In that image, nginx serves html files out of /config/www/ by default. Unless you have changed that location in your mapped config file, you should be mounting ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/nginx/www-data to that directory.
If you are unsure about your config file, try running the stack without it. The modified manifest would look like this:
services:
nginx:
image: lscr.io/linuxserver/nginx:latest
container_name: nginx
environment:
- PUID=1000
- PGID=10
- TZ=Etc/UTC
- NGINX_AUTORELOAD= #optional
- NGINX_AUTORELOAD_WATCHLIST= #optional
volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/nginx/www-data:/config/www # place your files for web here
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/nginx/logs:/var/log/nginx
ports:
- 8085:80
restart: unless-stopped