Nginx Reverse Proxy Ssl Error
So I Have My Nginx Reverse Proxy Set up as Follows. Listen 80; Server_Name Mydomain. Net; Return 301 } Server { Listen 443; Server_Name Mydomain. Net...
So I have my Nginx reverse proxy set up as follows.
listen 80;
server_name mydomain.net;
return 301
}
server {
listen 443;
server_name mydomain.net;
ssl_certificate /etc/letsencrypt/live/
ssl_certificate_key /etc/letsencrypt/live/
location / {
proxy_pass
}
}
But when I try to connect to my website it says "This site can't provide a secure connection, ERR_SSL_PROTOCOL_ERROR. Did I misconfigure SSL?
1 Answer
You should change the listen directive to listen with the SSL protocol: listen 80; says to listen for http connections on port 80, but listen 443 ssl; says to listen on port 443 for https connections.
the configuration should be as follows:
server {
listen 80;
server_name mydomain.net;
return 301
}
server {
listen 443 ssl;
server_name mydomain.net;
ssl_certificate /etc/letsencrypt/live/
ssl_certificate_key /etc/letsencrypt/live/
location / {
proxy_pass
}
}
you can also combine them. you can remove your return statement, and combine all others into one server block. just add this snippet:
if ($scheme = http) {
return 301
}