better domain+location handling
This commit is contained in:
24
templates/domain.conf.j2
Normal file
24
templates/domain.conf.j2
Normal file
@@ -0,0 +1,24 @@
|
||||
{% if ng_domain_secure|default(True) %}
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
# redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
server {
|
||||
{% if not ng_domain_secure %}
|
||||
listen 80 {{ ng_domain_flags | default(['http2']) | join(' ') }};
|
||||
listen [::]:80 {{ ng_domain_flags | default(['http2']) | join(' ') }};
|
||||
{% endif %}
|
||||
listen 443 ssl {{ ng_domain_flags | default(['http2']) | join(' ') }};
|
||||
listen [::]:443 ssl {{ ng_domain_flags | default(['http2']) | join(' ') }};
|
||||
|
||||
server_name {{ ng_domain_name | regex_replace('^default$','_') }};
|
||||
root {{ ng_domain_root|default('/usr/share/nginx/html') }};
|
||||
include locations/{{ ng_domain_name }}/*.conf;
|
||||
{% if ng_domain_common_locations | default(True) %}
|
||||
include locations/common/*.conf;
|
||||
{% endif %}
|
||||
}
|
||||
3
templates/location.conf.j2
Normal file
3
templates/location.conf.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
location {{ ng_location_name }} {
|
||||
{{ ng_location_content }}
|
||||
}
|
||||
Reference in New Issue
Block a user