Permalink
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (38 sloc) 935 Bytes
server {
{% if ssl %}
listen 443 ssl;
include ssl_params;
{% else %}
listen 80;
{% endif %}
include gzip_params;
server_name {{site_fqdn}};
root {{public_path}};
index index.html;
error_page 404 /404.html;
{% if ssl and inventory_hostname != 'vagrant' %}
# This allows certbot to get letsencrypt certs.
location /.well-known {
alias {{base_path}}/certbot/.well-known;
}
{% endif %}
# If you want to redirect everything to index.html (eg. for a web app),
# remove the error_page line above and uncomment this block:
# location / {
# try_files $uri /index.html;
# }
}
{% if ssl %}
# Force HTTPS for all connections.
server {
listen 80;
server_name {{site_fqdn}};
return 301 https://$server_name$request_uri;
}
{% endif %}
# Catchall, force unknown domains to redirect to site_fqdn.
server {
listen 80 default_server;
server_name _;
return 301 $scheme://{{site_fqdn}}$request_uri;
}