feat: add vhost defaults and autoindex
This commit is contained in:
parent
8890ba5d7a
commit
b7e53d6ca9
@ -38,6 +38,9 @@
|
|||||||
- global-artifact.svc.plus
|
- global-artifact.svc.plus
|
||||||
ssl_certificate: /etc/ssl/svc.plus.pem
|
ssl_certificate: /etc/ssl/svc.plus.pem
|
||||||
ssl_certificate_key: /etc/ssl/svc.plus.rsa.key
|
ssl_certificate_key: /etc/ssl/svc.plus.rsa.key
|
||||||
|
root: /data/update-server
|
||||||
|
autoindex_paths:
|
||||||
|
- "/"
|
||||||
type: artifact
|
type: artifact
|
||||||
roles:
|
roles:
|
||||||
- roles/vhosts/common/
|
- roles/vhosts/common/
|
||||||
|
|||||||
@ -7,14 +7,31 @@ server {
|
|||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
root /data/update-server;
|
root {{ item.root | default(vhost_defaults.root) }};
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
{% set autoindex_paths = item.autoindex_paths | default(vhost_defaults.autoindex_paths) %}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
{% if '/' in autoindex_paths %}
|
||||||
|
autoindex on;
|
||||||
|
autoindex_exact_size off;
|
||||||
|
autoindex_localtime on;
|
||||||
|
{% endif %}
|
||||||
add_header Accept-Ranges bytes;
|
add_header Accept-Ranges bytes;
|
||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% for path in autoindex_paths %}
|
||||||
|
{% if path != '/' %}
|
||||||
|
location {{ path }} {
|
||||||
|
autoindex on;
|
||||||
|
autoindex_exact_size off;
|
||||||
|
autoindex_localtime on;
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
location ~* \.(dmg|zip|tar\.gz|deb|rpm|exe|pkg|AppImage|apk|ipa)$ {
|
location ~* \.(dmg|zip|tar\.gz|deb|rpm|exe|pkg|AppImage|apk|ipa)$ {
|
||||||
expires 7d;
|
expires 7d;
|
||||||
access_log off;
|
access_log off;
|
||||||
|
|||||||
@ -36,3 +36,8 @@ journald_log_rotation: # 启用 journald 日志管理
|
|||||||
# selinux_enable: false
|
# selinux_enable: false
|
||||||
# ssh_auth:
|
# ssh_auth:
|
||||||
# key: /root/.ssh/id_rsa.pub
|
# key: /root/.ssh/id_rsa.pub
|
||||||
|
|
||||||
|
vhosts: []
|
||||||
|
vhost_defaults:
|
||||||
|
root: /data/update-server
|
||||||
|
autoindex_paths: []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user