infrastructure/roles/davina_core-and-nginx/templates/conf.j2

49 lines
1.2 KiB
Plaintext
Raw Normal View History

2025-09-25 23:55:37 +02:00
{% macro davina_core_common() %}
root {{var_davina_core_and_nginx_directory}};
2025-09-18 13:44:07 +02:00
index index.php;
2025-09-16 20:35:46 +02:00
location / {
2025-09-18 13:44:07 +02:00
try_files $uri $uri/ /index.php;
2025-09-16 21:42:25 +02:00
dav_methods PUT DELETE MKCOL COPY MOVE;
# dav_ext_methods PROPFIND PROPPATCH LOCK UNLOCK;
2025-09-18 13:44:07 +02:00
# dav_access user:rw group:rw all:r;
# create_full_put_path on;
}
location ~ \.php$ {
2025-09-16 20:35:46 +02:00
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REDIRECT_STATUS 200;
2025-09-18 13:44:07 +02:00
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
2025-09-16 20:35:46 +02:00
}
{% endmacro %}
server {
listen 80;
listen [::]:80;
2025-09-25 23:55:37 +02:00
server_name {{var_davina_core_and_nginx_domain}};
2025-09-16 20:35:46 +02:00
2025-09-25 23:55:37 +02:00
{% if var_davina_core_and_nginx_tls_mode == 'force' %}
2025-09-16 20:35:46 +02:00
return 301 https://$http_host$request_uri;
{% else %}
2025-09-25 23:55:37 +02:00
{{ davina_core_common() }}
2025-09-16 20:35:46 +02:00
{% endif %}
}
2025-09-25 23:55:37 +02:00
{% if var_davina_core_and_nginx_tls_mode != 'disable' %}
2025-09-16 20:35:46 +02:00
server {
listen 443 ssl;
listen [::]:443 ssl;
2025-09-25 23:55:37 +02:00
server_name {{var_davina_core_and_nginx_domain}};
2025-09-16 20:35:46 +02:00
2025-09-25 23:55:37 +02:00
ssl_certificate_key /etc/ssl/private/{{var_davina_core_and_nginx_domain}}.pem;
ssl_certificate /etc/ssl/fullchains/{{var_davina_core_and_nginx_domain}}.pem;
2025-09-16 20:35:46 +02:00
include /etc/nginx/ssl-hardening.conf;
2025-09-25 23:55:37 +02:00
{{ davina_core_common() }}
2025-09-16 20:35:46 +02:00
}
{% endif %}