ansible-nginx/templates/etc/nginx/sites-available/_owncloud.j2

88 lines
2.2 KiB
Django/Jinja

{% extends "_php.j2" %}
{% block root %}
root {{ nginx_owncloud_root }};
{% endblock %}
{% block template_index %}
index index.php;
{% endblock %}
{% block template_more %}
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
gzip off;
client_max_body_size 10G;
fastcgi_buffers 64 4K;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
{% endblock %}
{% block template_headers %}
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Content-Type-Options nosniff;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header X-Frame-Options SAMEORIGIN;
{% endblock %}
{% block template_try_files %}
try_files $uri $uri/ =404;
{% endblock %}
{% block template_upstream_location %}
location ~ /remote.php {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
fastcgi_pass {{ php_upstream }};
fastcgi_param HOME {{ nginx_owncloud_root }};
fastcgi_param HTTP_HOME {{ nginx_owncloud_root }};
fastcgi_param PATH /usr/local/bin:/usr/bin:/bin;
fastcgi_param modHeadersAvailable true;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
{% if nginx_version.stdout | version_compare('1.6.1', 'lt') %}
include fastcgi_params;
{% else %}
include fastcgi.conf;
{% endif %}
}
location ~ \.php(?:$|/) {
fastcgi_pass {{ php_upstream }};
fastcgi_index index.php;
fastcgi_param HOME {{ nginx_owncloud_root }};
fastcgi_param HTTP_HOME {{ nginx_owncloud_root }};
fastcgi_param PATH /usr/local/bin:/usr/bin:/bin;
fastcgi_param modHeadersAvailable true;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
{% if nginx_version.stdout | version_compare('1.6.1', 'lt') %}
include fastcgi_params;
{% else %}
include fastcgi.conf;
{% endif %}
}
{% endblock %}
{% block template_local_content %}
location ~* \.(?:css|js)$ {
try_files $uri /index.php$is_args$args;
expires 2h;
}
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
expires 2d;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(?:\.ht|data|config|db_structure\.xml|README){
deny all;
}
{% endblock %}