2023-03-20 12:35:39 +01:00
|
|
|
<% ssl_on = nginx.ssl.cert && nginx.ssl.cert_key %>
|
|
|
|
|
|
|
|
<% if ssl_on %>
|
2023-03-17 20:08:14 +01:00
|
|
|
server {
|
|
|
|
server_name <%= rc.hostname %>;
|
|
|
|
listen 80;
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
}
|
2023-03-20 12:35:39 +01:00
|
|
|
<% end %>
|
2023-03-17 20:08:14 +01:00
|
|
|
|
|
|
|
server {
|
|
|
|
gzip_static on;
|
|
|
|
server_name <%= rc.hostname %>;
|
|
|
|
error_log <%= nginx.logs.errors %> info;
|
|
|
|
access_log <%= nginx.logs.access %> combined;
|
|
|
|
location / {
|
|
|
|
root <%= nginx.root %>;
|
|
|
|
}
|
2023-03-20 12:35:39 +01:00
|
|
|
<% if ssl_on %>
|
|
|
|
listen 443 ssl;
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000" always;
|
|
|
|
ssl_certificate <%= nginx.ssl.cert %>;
|
|
|
|
ssl_certificate_key <%= nginx.ssl.cert_key %>;
|
|
|
|
<% else %>
|
2023-03-20 12:55:52 +01:00
|
|
|
listen 127.0.0.1:80;
|
2023-03-20 12:35:39 +01:00
|
|
|
<% end %>
|
2023-03-17 20:08:14 +01:00
|
|
|
}
|