Configuring Nginx SSL alongside non-ssl

Posted by user55145 on Server Fault See other posts from Server Fault or by user55145
Published on 2013-10-21T23:26:54Z Indexed on 2013/10/22 3:57 UTC
Read the original article Hit count: 238

Filed under:
|
|

I'm trying to enable SSL on my current Nginx configuration, which works fine. However I'm wondering if it's possible to do this alongside HTTP, so that i do not need another server{} section which would just be a replication of the http section.

I thought the following would work, however i get the below when accessing http://

400 Bad Request

The plain HTTP request was sent to HTTPS port

Nginx Config:

  ssl_certificate      /etc/nginx/ssl/domains.pem;
  ssl_certificate_key  /etc/nginx/ssl/server.key;

server {
        listen 80;
        listen 443;
    //other configuration
}

© Server Fault or respective owner

Related posts about nginx

Related posts about ssl