Here is my config:
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
access_log /var/log/nginx/bar.com.access.log;
rewrite ^(.*) https://bar.com$1 permanent;
location / {
root /var/www;
index index.html index.htm;
}
}
server {
listen 443;
ssl on;
ssl_certificate /root/ssl/ssl.crt;
ssl_certificate_key /root/ssl/ssl.key;
location / {
root /var/www;
index index.html index.htm;
}
}