Nginx SSL configuration for HTTPS and HTTP

The following config will make the domain available both on HTTP and HTTPS protocols:

1
2
3
4
5
6
7
8
9
10
11
12
13
server {
  listen 80;
  listen 443 default ssl;
  #ssl on;  ##### SEE: http://stackoverflow.com/a/8811733/269622
  ssl_certificate /var/www/domain.com/ssl/domain.com.crt;
  ssl_certificate_key /var/www/domain.com/ssl/domain.com.key;

  server_name domain.com;

  root /var/www/domain.com/httpdocs/;

  # ...
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>