title: 'LibreSSL SSL_connect: SSL_ERROR_SYSCALL' on curl to NGINX reverse proxy on a Docker Container
body: <p>I am able to successfully get a NGINX reverse proxy running locally with SSL enabled. However, once I try to get it running on a Docker container, I get issues with SSL. </p>
  
  <p>I portforwarded to port 9443 using <code>docker run -it nginxProxy -v local_path_to_certs:container_path_to_certs -p 9443:443</code>.</p>
  
  <p>My Dockerfile:</p>
  
  <pre><code>FROM nginx:alpine
  
  # Expost port 443
  EXPOSE 443
  
  RUN rm -v /etc/nginx/nginx.conf
  RUN rm -rf /etc/nginx/conf.d
  
  # Copy custom configuration file from the current directory
  COPY nginx.conf /etc/nginx/nginx.conf
  
  ENTRYPOINT [ "nginx", "-c", "/etc/nginx/nginx.conf", "-g", "daemon off;"]
  </code></pre>
  
  <p>My nginx.conf:</p>
  
  <pre><code>events {
      worker_connections 1024;
  }
  
  
  http {
  
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4:!SHA:!SHA1:!SSLv2:@STRENGTH;
    ssl_prefer_server_ciphers on;
  
    ssl_certificate           /path_to_cert/public.cert.pem;
    ssl_certificate_key       /path_to_private_key/private.key.pem;
    ssl_password_file         /path_to_password_file/password.txt;
  
    server {
      listen [::]:443 ssl;
  
      server_name _;
  
      location / {
         proxy_pass https://example.com; 
  
      }
    }
  }
  </code></pre>
  
  <p>On my local machine, this works as fine as expected, but when running on a Docker container running <code>curl https://localhost:9443 -vvv</code> gives me </p>
  
  <pre><code>* Rebuilt URL to: https://localhost:9443/
  *   Trying ::1...
  * TCP_NODELAY set
  * Connected to localhost (::1) port 9443 (#0)
  * ALPN, offering h2
  * ALPN, offering http/1.1
  * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  * successfully set certificate verify locations:
  *   CAfile: /etc/ssl/cert.pem
    CApath: none
  * TLSv1.2 (OUT), TLS handshake, Client hello (1):
  * LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:9443 
  * Closing connection 0
  curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:9443 
  </code></pre>