weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
1.86k stars 187 forks source link

Docker Compose Yaml #301

Closed RobinGiel closed 2 years ago

RobinGiel commented 2 years ago

here is my current docker compose yml

version: '3.5'
services:
  app:
    image: 'ghcr.io/weserv/images:5.x'
    container_name: weservimages
    shm_size: '1gb'
    ports:
      - 8082:80
    restart: always
    networks:
      - imagesweserv
networks:
  imagesweserv:
    external:
      name: imagesweserv

All of my other containers were very easy to add a reverse proxy to access a container with nginx proxy manager, expect this one. Is there something I'm doing wrong or missing? The container is running fine on http but when I want to access it using https with a reverse proxy I can't

kleisauke commented 2 years ago

By default, the container will only bind to port 80 on both IPv4 and IPv6. You'll need to make the following adjustment in the nginx configuration if you want to configure HTTPS:

--- a/etc/nginx/imagesweserv.conf
+++ b/etc/nginx/imagesweserv.conf
@@ -65,7 +65,12 @@ server {

 server {
     listen 80 default_server;
+    listen 443 ssl default_server;
     listen [::]:80 default_server ipv6only=on;
+    listen [::]:443 ssl default_server ipv6only=on;
+
+    ssl_certificate <path to cert>;
+    ssl_certificate_key <path to key>;

     server_name _;

(also see https://nginx.org/en/docs/http/configuring_https_servers.html)

After that, reload the configuration with:

docker exec imagesweserv nginx -s reload
RobinGiel commented 2 years ago

I actually had more an issue with my networks in the docker compose file, they were not pointed at the right network for me. Thanks for the reply :-)