]> git.somenet.org - root/pub/somesible.git/blob - roles/service/mediawiki-no-install/vars/default/vars_nginx_vhost_custom.yml
roles/base/backup/files
[root/pub/somesible.git] / roles / service / mediawiki-no-install / vars / default / vars_nginx_vhost_custom.yml
1 #####################################
2 ### someone"s ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 vhost_custom_pre_server: |-
9
10 vhost_custom: |-
11     # image authentication
12     location ~ ^/images/ {
13         if (!-f $request_filename){ return 404; }
14         rewrite ^/images/(.*)$ /img_auth.php/$1?$args last;
15     }
16
17     # hide some paths
18     location ^~ /images/deleted/ { return 404; }
19     location ^~ /maintenance/ { return 404; }
20     location ^~ /cache/ { return 404; }
21     location ^~ /logs/ { return 404; }
22
23     # cacheable static files
24     location ~ ^/(?!wiki\/).*\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2|ico)$ {
25         try_files $uri =404;
26         add_header Cache-Control "public";
27         expires 7d;
28     }
29
30     # nice urls
31     location ~ ^/wiki/ { rewrite ^/wiki/(.*)$ /index.php?title=$1&$args last; }
32
33     ## keep for legacy-reasons
34     location = /wiki { rewrite ^ /index.php permanent; }
35     # old. maybe delete in 2023-07?
36     location ^~ /wiki/index.php/ { rewrite ^/wiki/index.php/(.*)$ /wiki/$1 permanent; }
37     location ^~ /index.php/ { rewrite ^/index.php/(.*)$ /wiki/$1 permanent; }