2020-04-06 10:41:51 +02:00
|
|
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
|
|
|
location __PATH__/ {
|
2018-02-15 18:37:46 +01:00
|
|
|
|
2020-05-17 14:55:51 +02:00
|
|
|
# Path to source
|
|
|
|
alias __FINALPATH__/public/ ;
|
|
|
|
|
2017-07-23 13:42:48 +02:00
|
|
|
if ($scheme = http) {
|
2020-05-17 14:55:51 +02:00
|
|
|
rewrite ^ https://$server_name$request_uri? permanent;
|
2017-07-23 13:42:48 +02:00
|
|
|
}
|
2018-02-15 18:37:46 +01:00
|
|
|
|
2019-08-24 12:54:18 +02:00
|
|
|
index index.php;
|
2018-02-15 18:37:46 +01:00
|
|
|
|
2018-02-12 21:53:49 +01:00
|
|
|
# Bug in Nginx with locations and aliases (see http://stackoverflow.com/a/35102259 )
|
2020-10-24 16:25:39 +02:00
|
|
|
try_files $uri $uri/ __PATH_HACK__/index.php?$query_string;
|
|
|
|
#if (!-e $request_filename) { rewrite ^ __PATH_HACK__/index.php last; }
|
2016-10-05 19:44:08 +02:00
|
|
|
|
|
|
|
location ~* \.php$ {
|
|
|
|
fastcgi_split_path_info ^(.+.php)(/.+)$;
|
2020-06-12 05:42:02 +02:00
|
|
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
2016-10-05 19:44:08 +02:00
|
|
|
include fastcgi_params;
|
2017-02-22 18:53:47 +01:00
|
|
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
2016-10-05 19:44:08 +02:00
|
|
|
fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
|
|
|
|
fastcgi_index index.php;
|
2016-10-08 19:08:37 +02:00
|
|
|
fastcgi_read_timeout 600;
|
2016-10-05 19:44:08 +02:00
|
|
|
}
|
2018-02-15 18:37:46 +01:00
|
|
|
|
2019-08-24 12:54:18 +02:00
|
|
|
# Expire rules for static content
|
|
|
|
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
|
2019-09-15 16:15:09 +02:00
|
|
|
more_set_headers "Cache-Control: max-age=0";
|
2019-08-24 12:54:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
location ~* \.(?:rss|atom)$ {
|
2019-09-15 16:15:09 +02:00
|
|
|
more_set_headers "Cache-Control: max-age=3600";
|
2019-08-24 12:54:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
|
2019-09-15 16:15:09 +02:00
|
|
|
more_set_headers "Cache-Control: max-age=2592000";
|
2019-08-24 12:54:18 +02:00
|
|
|
access_log off;
|
2016-10-05 19:44:08 +02:00
|
|
|
}
|
|
|
|
|
2019-08-24 12:54:18 +02:00
|
|
|
location ~* \.(?:css|js)$ {
|
2019-09-15 16:15:09 +02:00
|
|
|
more_set_headers "Cache-Control: max-age=31536000";
|
2019-08-24 12:54:18 +02:00
|
|
|
access_log off;
|
2016-10-05 19:44:08 +02:00
|
|
|
}
|
|
|
|
|
2019-08-24 12:54:18 +02:00
|
|
|
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
|
2019-09-15 16:15:09 +02:00
|
|
|
more_set_headers "Cache-Control: max-age=2592000";
|
2019-08-24 12:54:18 +02:00
|
|
|
access_log off;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Gzip compression
|
2016-10-05 19:44:08 +02:00
|
|
|
gzip on;
|
2019-08-24 12:54:18 +02:00
|
|
|
gzip_comp_level 5;
|
|
|
|
gzip_min_length 256;
|
2016-10-05 19:44:08 +02:00
|
|
|
gzip_proxied any;
|
2019-08-24 12:54:18 +02:00
|
|
|
gzip_vary on;
|
|
|
|
gzip_types
|
|
|
|
application/atom+xml
|
|
|
|
application/javascript
|
|
|
|
application/json
|
|
|
|
application/ld+json
|
|
|
|
application/manifest+json
|
|
|
|
application/rss+xml
|
|
|
|
application/vnd.geo+json
|
|
|
|
application/vnd.ms-fontobject
|
|
|
|
application/x-font-ttf
|
|
|
|
application/x-web-app-manifest+json
|
|
|
|
application/xhtml+xml
|
|
|
|
application/xml
|
|
|
|
font/opentype
|
|
|
|
image/bmp
|
|
|
|
image/svg+xml
|
|
|
|
image/x-icon
|
|
|
|
text/cache-manifest
|
|
|
|
text/css
|
|
|
|
text/plain
|
|
|
|
text/vcard
|
|
|
|
text/vnd.rim.location.xloc
|
|
|
|
text/vtt
|
|
|
|
text/x-component
|
|
|
|
text/x-cross-domain-policy;
|
2016-10-05 19:44:08 +02:00
|
|
|
|
|
|
|
# Include SSOWAT user panel.
|
2017-02-21 21:11:23 +01:00
|
|
|
# include conf.d/yunohost_panel.conf.inc;
|
2016-10-05 19:44:08 +02:00
|
|
|
}
|