updated nginx state

This commit is contained in:
Paul 2020-07-19 23:41:13 +02:00
parent 3f63069424
commit e7812233ce
4 changed files with 82 additions and 1 deletions

View File

@ -39,7 +39,7 @@ nginx-config-dir-{{ subdir }}:
nginx-sites-available-{{ key }}:
file.managed:
- name: {{ nginx.config.dir }}/sites-available/{{ key }}
- source: salt://nginx/vhost.j2
- source: salt://nginx/templates/types/{{ vhost.type }}.j2
- template: jinja
- user: {{ nginx.config.user }}
- group: {{ nginx.config.group }}

View File

@ -0,0 +1,30 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
server {
include http;
server_name {{ vhost_name }};
return 301 https://$server_name$request_uri;
}
server {
include https;
server_name {{ vhost_name }};
root {{ root_dir }};
index index.php index.html;
location ~ /(conf|bin|inc)/ {
deny all;
}
location ~ /data/ {
internal;
}
location ~ \.php?$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}

View File

@ -0,0 +1,51 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
server {
include http;
server_name {{ vhost_name }};
return 301 https://$server_name$request_uri;
}
server {
include https;
server_name {{ vhost_name }};
root {{ root_dir }};
index index.php
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
client_max_body_size 4G;
fastcgi_buffers 64 4K;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
location ~ ^(.+?\.php)(/.*)?$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $1 =404;
}
}