Getting SSL errors with nginx

ben432rew asked:

I’ve got a digitalocean droplet up and running, and the ip on my dashboard 159.xxx.xxx.xx, and with nano /etc/nginx/sites-available/hello_world I have this config file:

server {
  listen 80;
  server_name 159.xxx.xxx.xx;

  location / {
    proxy_pass https://127.0.0.1:8000;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

  location /static/ {
    alias /root/dev/hello_world/staticfiles/;
  }
}

When I got to https://159.xxx.xxx.xx:80/ in my browser, I get this ssl_error_rx_record_too_long in Firefox, and ERR_SSL_PROTOCOL_ERROR in Chrome.

This happens whether I have gunicorn running or not gunicorn hello_world.wsgi --bind 127.0.0.1:8000

Why am I getting this error, and what can I do to fix it? Thanks in advance for your patience.

My answer:


You get an SSL protocol error because nginx is only serving HTTP on port 80, not HTTPS. But you mistyped https at the beginning of your URL.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.