bunkerity / bunkerweb

🛡️ Open-source and next-generation Web Application Firewall (WAF)
https://www.bunkerweb.io
GNU Affero General Public License v3.0
6.17k stars 342 forks source link

Letsencrypt renew with custom https-conf #90

Closed jblacas closed 3 years ago

jblacas commented 3 years ago

Hello guys,

I am facing an issue while using the below docker-compose to enable auto letsencrypt along with custom http-confs.

    myreverse:
        image: bunkerity/bunkerized-nginx
        restart: always
        network_mode: bridge
        ports:
          - 80:8080
          - 443:8443
        volumes:
          - ./www/current/dist:/www:ro
          - /etc/letsencrypt:/etc/letsencrypt
          - ./custom-nginx-conf:/http-confs:ro
        environment:
          - SERVER_NAME=xyz-domain.com
          - AUTO_LETS_ENCRYPT=yes
          - EMAIL_LETS_ENCRYPT=contact@xyz-domain.com
          - DISABLE_DEFAULT_SERVER=yes
          - REDIRECT_HTTP_TO_HTTPS=yes
          - SERVE_FILES=yes
          - USE_PROXY_CACHE=yes

Inside my custom-nginx-conf I have a server block which define the server_name as such, If I don't provide it, I get an invalid certificate warning on my browser.

server {
  listen 8443 ssl default_server;
  ssl_certificate    /etc/letsencrypt/live/xyz-domain.com/fullchain.pem;
  ssl_certificate_key  /etc/letsencrypt/live/xyz-domain.com/privkey.pem;
  port_in_redirect off;
  server_name xyz-domain.com;
}

I might be missing something because when I run my container I see this message nginx: [warn] conflicting server name "xyz-domain.com" on 0.0.0.0:8443, ignored.

The documentation could be clearer on how to use custom http-confs with letsencrypt I guess

Thank you and keep up the good work :+1:

fl0ppy-d1sk commented 3 years ago

Hello @jblacas,

Can you provide more info like the content of /etc/nginx/server.conf and full logs ? Also can you try the new 1.2.3 version ? It should work without the additionnal http confs. Please note that you will need to edit rights of your volumes because the container is not running as root anymore.

fl0ppy-d1sk commented 3 years ago

Closing this because of inactivity. Don't hesitate to reopen it if needed.