43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
|
server {
|
||
|
listen {{ service.port | default(80) }};
|
||
|
|
||
|
server_name {{ service.domain_name }};
|
||
|
access_log /var/log/nginx/{{ service.domain_name }}-access.log;
|
||
|
error_log /var/log/nginx/{{ service.domain_name }}-error.log;
|
||
|
|
||
|
include letsencrypt.conf;
|
||
|
|
||
|
{% if service.redirect_to_https %}
|
||
|
location / {
|
||
|
return 301 https://$host$request_uri;
|
||
|
}
|
||
|
{% else %}
|
||
|
location / {
|
||
|
proxy_pass http://{{ service.internal_ip }}:{{ service.internal_port }};
|
||
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
{% if service.http_opts is defined %}
|
||
|
{% for opt in service.http_opts %}
|
||
|
{{ opt }}
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
}
|
||
|
{% endif %}
|
||
|
{% if service.http_custom_locations is defined %}
|
||
|
{% for location in service.http_custom_locations %}
|
||
|
location {{ location.rule }} {
|
||
|
{% for conf_line in location.conf_lines %}
|
||
|
{{ conf_line }};
|
||
|
{% endfor %}
|
||
|
}
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
{% if service.http_custom_configurations is defined %}
|
||
|
{% for conf in service.http_custom_configurations %}
|
||
|
{{ conf }};
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
}
|