Nakiami / mellivora

Mellivora is a CTF engine written in PHP
GNU General Public License v3.0
440 stars 171 forks source link

Trouble with setting up SSL behind nginx reverse proxy #121

Closed zelinsky closed 5 years ago

zelinsky commented 5 years ago

Hello, I've been trying to set up mellivora behind an nginx reverse proxy (docker-letsencrypt). Docker-letsencrypt is a docker container running an nginx reverse proxy with ssl, and I have my mellivora instance running as a docker container. Basically the lets-encrypt container should proxypass to the mellivora container. I've been trying to get everything configured correctly, but this is the error I've been getting from nginx: `1 connect() failed (111: Connection refused) while connecting to upstream, client: w.x.y.z, server: , request: "GET / HTTP/2.0", upstream: "https://192.168.0.5:443/", host: mydomain.com" 1 connect() failed (111: Connection refused) while connecting to upstream, client: w.x.y.z, server: _, request: "GET /favicon.ico HTTP/2.0", upstream: "https://192.168.0.5:443/favicon.ico", host: "mydomain.com", referrer: "https://mydomain.com/"`

and I get a "502 Bad Gateway" error on my browser when visiting my domian.

I have these lines in my config.inc.php file: Config::set('MELLIVORA_CONFIG_SITE_URL', 'https://mydomain.com/'); Config::set('MELLIVORA_CONFIG_SITE_URL_STATIC_RESOURCES', 'https://mydomain.com/'); Config::set('MELLIVORA_CONFIG_SSL_COMPAT', true);

Here is my nginx proxy config. Here is my docker compose.

Also, I can successfully ping the mellivora container from the lets-encrypt container.

zelinsky commented 5 years ago

Figured it out (or at least something that works): proxy_pass https://$upstream_mellivora:443; should be proxy_pass http://$upstream_mellivora:80;