2023-12-17 15:08:08 +01:00
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
2023-12-18 08:13:44 +01:00
|
|
|
server_name {{var_dokuwiki_and_nginx_domain}};
|
|
|
|
return 301 https://$server_name$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2023-12-17 15:08:08 +01:00
|
|
|
listen [::]:443 ssl;
|
2023-12-18 08:13:44 +01:00
|
|
|
listen 443 ssl;
|
2023-12-17 15:08:08 +01:00
|
|
|
|
|
|
|
server_name {{var_dokuwiki_and_nginx_domain}};
|
2023-12-18 08:13:44 +01:00
|
|
|
|
2023-12-17 15:08:08 +01:00
|
|
|
{% if var_dokuwiki_and_nginx_tls_enable %}
|
|
|
|
ssl_certificate /etc/ssl/fullchains/{{var_dokuwiki_and_nginx_domain}}.pem;
|
|
|
|
ssl_certificate_key /etc/ssl/private/{{var_dokuwiki_and_nginx_domain}}.pem;
|
2023-12-18 08:13:44 +01:00
|
|
|
ssl_session_timeout 5m;
|
|
|
|
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
|
2023-12-17 15:08:08 +01:00
|
|
|
{% endif %}
|
|
|
|
|
2023-12-18 08:13:44 +01:00
|
|
|
# Maximum file upload size is 4MB - change accordingly if needed
|
|
|
|
client_max_body_size 4M;
|
|
|
|
client_body_buffer_size 128k;
|
|
|
|
|
|
|
|
root {{var_dokuwiki_and_nginx_directory}};
|
|
|
|
index doku.php;
|
|
|
|
|
|
|
|
#Remember to comment the below out when you're installing, and uncomment it when done.
|
|
|
|
location ~ /(conf/|bin/|inc/|vendor/|install.php) {
|
2023-12-18 08:40:46 +01:00
|
|
|
deny all;
|
2023-12-18 08:13:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#Support for X-Accel-Redirect
|
|
|
|
location ~ ^/data/ {
|
|
|
|
internal;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/lib.*\.(js|css|gif|png|ico|jpg|jpeg)$ {
|
|
|
|
expires 365d;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
try_files $uri $uri/ @dokuwiki;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @dokuwiki {
|
|
|
|
# rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
|
|
|
|
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
|
|
|
|
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
|
|
|
|
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
|
|
|
|
rewrite ^/(.*) /doku.php?id=$1&$args last;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ \.php$ {
|
|
|
|
try_files $uri $uri/ /doku.php;
|
|
|
|
include fastcgi_params;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
fastcgi_param REDIRECT_STATUS 200;
|
|
|
|
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
|
|
|
|
# fastcgi_pass unix:/var/run/php5-fpm.sock; #old php version
|
|
|
|
}
|
2023-12-17 15:08:08 +01:00
|
|
|
}
|