Hi.
I also run a dokuwiki under a subdirectory with nginx. On my computer, the latest DW is always available at http
s://schplurtz.mydomain.org/latestdw . Here are the relevant part of my nginx config file. The only difference I can see between your config and mine is that you use alias, while I use root. Using root imposes one more directory. On the drive, doku.php is located at /web/mainsite/dokus/latestdw/doku.php . (latestdw directory is here to match the /latestdw of the URL)
server {
server_name schplurtz.mydomain.org schplurtz.mydomain.fr;
# NEVER, EVER activate these settings, except when debugging.
# Just too many lines (hundreds) for each and every single request.
#DEBUG-OFF# error_log /var/log/nginx-error-default_server-debug.log debug;
#DEBUG-OFF# access_log /var/log/nginx-http-default_server-access.log combined;
#DEBUG-OFF# rewrite_log on;
root /web/mainsite/mainapp;
include partials/schplurtz/root-app.conf;
# include partials/schplurtz/doku/latestdw.conf; # inlined
#
# DOKUWIKI-LATEST CONFIG START
#
# Deny access to data, conf etc... folders
location ~ /latestdw/(data|conf|bin|inc)/ {
deny all;
}
location /latestdw {
# there must exist a directory named latestdw inside /web/mainsite/dokus.
root /web/mainsite/dokus;
index index.php;
try_files $uri $uri/ @latestdw;
# Since root is changed, php config must be set again.
location ~ \.php$ {
# Workaround PHP vulnerability:
# http://forum.nginx.org/read.php?2,88845,page=3
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Must match php-fastcgi service options, of course...
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
location @latestdw {
rewrite ^/latestdw/_media/(.*) /latestdw/lib/exe/fetch.php?media=$1 last;
rewrite ^/latestdw/_detail/(.*) /latestdw/lib/exe/detail.php?media=$1 last;
rewrite ^/latestdw/_export/([^/]+)/(.*) /latestdw/doku.php?do=export_$1&id=$2 last;
rewrite ^/latestdw/(.*) /latestdw/doku.php?id=$1 last;
}
#
# DOKUWIKI-LATEST CONFIG END
#
# php config for the main site root (/web/mainsite/mainapp)
location ~ \.php$ {
# Workaround PHP vulnerability:
# http://forum.nginx.org/read.php?2,88845,page=3
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Must match php-fastcgi service options, of course...
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location /QUELBAZAR {
autoindex on;
}
}
nginx config is tricky. If you want to know what nginx does with the URL, try to add those lines at the start of the server section of your nginx config file.
# NEVER, EVER activate these settings, except when debugging.
# Just too many lines (hundreds) for each and every single request.
error_log /tmp/nginx-error-debug.log debug;
access_log /tmp/nginx-access.log combined;
rewrite_log on;
Restart nginx try to access /subdirectory/install.php then
grep -E 'http request line| using |location' /tmp/nginx-error-debug.log, (or simply browse the file with your favorite pager). grep will print things like this that may help understanding what is happening :
2019/07/21 15:08:05 [debug] 25106#25106: *1 http request line: "GET /4newdoku/foo HTTP/1.1"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "QUELBAZAR"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "4newdoku/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/([._]ht|README$|VERSION$|COPYING$)"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/4newdoku/(data|conf|bin|inc)/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/latestdw/(data|conf|bin|inc)/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/doku-test"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "\.php$"
2019/07/21 15:08:05 [debug] 25106#25106: *1 using configuration "/4newdoku/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "@4newdoku"
2019/07/21 15:08:05 [debug] 25106#25106: *1 using location: @4newdoku "/4newdoku/foo?"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "QUELBAZAR"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "4newdoku/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/([._]ht|README$|VERSION$|COPYING$)"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/4newdoku/(data|conf|bin|inc)/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/latestdw/(data|conf|bin|inc)/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "/doku-test"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: ~ "\.php$"
2019/07/21 15:08:05 [debug] 25106#25106: *1 using configuration "\.php$"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "QUELBAZAR"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "4newdoku/"
2019/07/21 15:08:05 [debug] 25106#25106: *1 test location: "404.html"
2019/07/21 15:08:05 [debug] 25106#25106: *1 using configuration "=/404.html"
2019/07/21 15:10:48 [debug] 25108#25108: *3 http request line: "GET /latestdw/install.php HTTP/1.1"
2019/07/21 15:10:48 [debug] 25108#25108: *3 test location: "/"
2019/07/21 15:10:48 [debug] 25108#25108: *3 test location: "QUELBAZAR"
2019/07/21 15:10:48 [debug] 25108#25108: *3 test location: "latestdw"
2019/07/21 15:10:48 [debug] 25108#25108: *3 test location: ~ "\.php$"
2019/07/21 15:10:48 [debug] 25108#25108: *3 using configuration "\.php$"