0

I'm testing Jwilder nginx-proxy custom nginx configuration using this command:

version: "3.8"

services:
    reverse-proxy:
        image: "jwilder/nginx-proxy:latest"
        container_name: "reverse-proxy"
        volumes:
            - "html:/usr/share/nginx/html"
            - "dhparam:/etc/nginx/dhparam"
            - "vhost:/etc/nginx/vhost.d"
            - "certs:/etc/nginx/certs"
            - "/run/docker.sock:/tmp/docker.sock:ro"
            - "PATH_TO/conf/myconf.conf:/etc/nginx/conf.d/myconf.conf:ro"
        restart: "always"
        networks: 
            - "net"
        ports:
            - "80:80"
            - "443:443"

    letsencrypt:
        image: "jrcs/letsencrypt-nginx-proxy-companion:latest"
        container_name: "letsencrypt-helper"
        volumes:
            - "html:/usr/share/nginx/html"
            - "dhparam:/etc/nginx/dhparam"
            - "vhost:/etc/nginx/vhost.d"
            - "certs:/etc/nginx/certs"
            - "/run/docker.sock:/var/run/docker.sock:ro"
        environment:
            NGINX_PROXY_CONTAINER: "reverse-proxy"
            DEFAULT_EMAIL: "user@domain.com"
        restart: "always"
        depends_on:
            - "reverse-proxy"
        networks: 
            - "net"

volumes:
    certs:
    html:
    vhost:
    dhparam:

networks:
    net:
        external: true

this part doesn't seem to work

"PATH_TO/conf/myconf.conf:/etc/nginx/conf.d/myconf.conf:ro"

I have this error

nginx: [emerg] open() "/etc/nginx/security-headers-ssl.conf"
failed (2: No such file or directory) in /etc/nginx/conf.d/myconf.conf:34

I also tried adding custom config directly via the below, but it also didn't work.

docker cp PATH_TO/conf/myconf.conf reverse-proxy:/etc/nginx/conf.d/
The Fool
  • 16,715
  • 5
  • 52
  • 86
CookieThief
  • 158
  • 2
  • 10
  • I think nginx image uses nginx user inside the image. You may want to `chown nginx:nginx /path/to/config/volume` (outside the container). You need to look up if nginx is the correct user, though. – The Fool Aug 24 '21 at 18:07
  • Also, this is just a dummy because you don't want to show it in the question, right? `PATH_TO`. – The Fool Aug 24 '21 at 18:13

0 Answers0