-
Notifications
You must be signed in to change notification settings - Fork 3.1k
nginx exits with error 1#1: unexpected ":" in /etc/nginx/conf.d/default.conf:76
#1183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I ran into this issue with dockerized gmvault. You have to pass an additional param |
wadkar
added a commit
to wadkar/nginx-proxy
that referenced
this issue
Oct 25, 2018
This commit fixes the SSL23_GET_SERVER_HELLO unknown protocol error when using `docker-compose-separate-containers.yml` and redirecting to an upstream HTTPS server. Example error: ``` nginx | 2018/10/25 09:06:06 [error] 9#9: *1 SSL_do_handshake() failed (SSL: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol) while SSL handshaking to upstream, client: 172.18.8.224, server: whoami.my.server, request: "GET / HTTP/2.0", upstream: "https://172.27.0.3:8000/", host: "whoami.my.server" ``` Steps to reproduce: Make sure you have the necessary `*.{crt,key,dhparam.pem}` files generated in the `./config/nginx/certs` directory. Then use following docker-compose-separate-container.yml file to do a `docker-compose up`: ``` version: "2" services: nginx: image: nginx:alpine #restart: always #TODO: Remove me in production container_name: nginx ports: - "80:80" - "443:443" volumes: - /etc/nginx/conf.d - ./config/nginx/certs:/etc/nginx/certs dockergen: #restart: always #TODO: Remove me in production image: jwilder/docker-gen command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf volumes_from: - nginx volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - ./config/docker-gen/templates:/etc/docker-gen/templates whoami: image: jwilder/whoami environment: # Please, for the love of god, don't escape strings here!! # See: nginx-proxy#1183 - VIRTUAL_HOST=whoami.my.server - VIRTUAL_PROTO=https - VIRTUAL_PORT=8000 ``` When you visit `https://whoami.my.server`, you will see a SSL handshake error in the `nginx` container (see example error string above). While I can't find which SO answer pointed me to rewrite the `proxy_pass` URL to start with `http` instead of `https`, but this change in the `nginx.tmpl` file solved the issue for me. Note that I am testing on "fake local domains" by manipulating the `/etc/hosts` on the client side. If this change in the code does not make sense, please let me know what I am missing. Thanks, -Sudarshan
I am closing this issue by creating a section in the [troubleshooting page]((https://github.com/jwilder/nginx-proxy/wiki/Troubleshooting) on the wiki. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
This is certainly not a question as I already have answer/workaround. Perhaps the same could be added to FAQ/README.md? Let me know and I will be happy to submit a PR.
Issue:
Passing
VIRTUAL_PROTO='HTTPS'
in docker-compose.yml will generate incorrect/etc/nginx/conf.d/default.conf
and thenginx
named container will exit with following error:Please excuse me if this sounds silly for you
YAML
ninjas, but I have been passingenvironments:
in thedocker-compose.yml
file with value of the environment variable in quotes, e.g.While this works nicely from command line
docker run -e VIRTUAL_PROTO='https' …
, the same fails to generate parsabledefault.conf
for nginx when called with docker-compose.The solution/workaround is to not use quotes around the values for the environment variable.
Thanks,
-Sudarshan
The text was updated successfully, but these errors were encountered: