server { server_name wiki.kalen.pw; root /web/dokuwiki; index index.php index.html index.html; location / { try_files $uri $uri/ @dokuwiki; } location @dokuwiki { 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$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/wiki.kalen.pw/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/wiki.kalen.pw/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot if ($scheme = http) { return 301 https://$server_name$request_uri; } } server { if ($host = wiki.kalen.pw) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; server_name wiki.kalen.pw; return 404; # managed by Certbot }