mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
91 lines
2.8 KiB
Nginx Configuration File
91 lines
2.8 KiB
Nginx Configuration File
location #LOCATION# {
|
||
alias #DESTDIR#;
|
||
|
||
if ($scheme = http) {
|
||
rewrite ^ https://$server_name$request_uri? permanent;
|
||
}
|
||
|
||
# Add headers to serve security related headers
|
||
add_header Strict-Transport-Security "max-age=15768000;";
|
||
add_header X-Content-Type-Options nosniff;
|
||
add_header X-Frame-Options "SAMEORIGIN";
|
||
add_header X-XSS-Protection "1; mode=block";
|
||
add_header X-Robots-Tag none;
|
||
add_header X-Download-Options noopen;
|
||
add_header X-Permitted-Cross-Domain-Policies none;
|
||
|
||
# Set max upload size
|
||
client_max_body_size 10G;
|
||
|
||
# Disable gzip to avoid the removal of the ETag header
|
||
gzip off;
|
||
|
||
# Index and errors pages
|
||
index index.php;
|
||
error_page 403 #PATH#/core/templates/403.php;
|
||
error_page 404 #PATH#/core/templates/404.php;
|
||
|
||
# Rules for served well-known paths
|
||
rewrite ^#PATH#/.well-known/carddav #PATH#/remote.php/dav/ permanent;
|
||
rewrite ^#PATH#/.well-known/caldav #PATH#/remote.php/dav/ permanent;
|
||
|
||
# The following 2 rules are only needed for the user_webfinger app.
|
||
# Uncomment it if you're planning to use this app.
|
||
#rewrite ^#PATH#/.well-known/host-meta #PATH#/public.php?service=host-meta last;
|
||
#rewrite ^#PATH#/.well-known/host-meta.json #PATH#/public.php?service=host-meta-json last;
|
||
|
||
# Other rewrite rules
|
||
rewrite ^#PATH#/remote/(.*) /remote.php last;
|
||
rewrite ^(#PATH#/core/doc/[^\/]+/)$ $1/index.html;
|
||
|
||
# Catch unknown files
|
||
try_files $uri $uri/ =404;
|
||
|
||
location = #PATH#/robots.txt {
|
||
allow all;
|
||
log_not_found off;
|
||
access_log off;
|
||
}
|
||
|
||
location ~ \.php(?:$|/) {
|
||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||
include fastcgi_params;
|
||
fastcgi_buffers 64 4K;
|
||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||
fastcgi_param HTTPS on;
|
||
fastcgi_param modHeadersAvailable true;
|
||
fastcgi_param REMOTE_USER $remote_user;
|
||
fastcgi_pass unix:/var/run/php5-fpm-#APP#.sock;
|
||
}
|
||
|
||
# Adding the cache control header for js and css files
|
||
location ~* \.(?:css|js)$ {
|
||
add_header Cache-Control "public, max-age=7200";
|
||
# Add headers to serve security related headers
|
||
add_header Strict-Transport-Security "max-age=15768000;";
|
||
add_header X-Content-Type-Options nosniff;
|
||
add_header X-Frame-Options "SAMEORIGIN";
|
||
add_header X-XSS-Protection "1; mode=block";
|
||
add_header X-Robots-Tag none;
|
||
add_header X-Download-Options noopen;
|
||
add_header X-Permitted-Cross-Domain-Policies none;
|
||
# Optional: Don't log access to assets
|
||
access_log off;
|
||
}
|
||
|
||
# Optional: Don't log access to other assets
|
||
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
|
||
access_log off;
|
||
}
|
||
|
||
# show YunoHost panel access
|
||
include conf.d/yunohost_panel.conf.inc;
|
||
}
|
||
|
||
location ~ ^#PATH#/(build|tests|config|lib|3rdparty|templates|data)/ {
|
||
deny all;
|
||
}
|
||
location ~ ^#PATH#/(?:\.|autotest|occ|issue|indie|db_|console) {
|
||
deny all;
|
||
}
|