The following is my Nginx vhost configuration file, which is added to the nginx rewrite rule for your reference:
Server {
Listen 80;
Server_name 111cn.net www.111cn.net;
Access_log/data/wwwlogs/111cn.net _ nginx. log combined;
Index index.html index. php duku. php;
Include/usr/local/nginx/conf/none. conf;
Root/data/wwwroot/111cn.net;
Location/{try_files $ 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 ^ /(?! Lib/) (. *)/doku. php? Id = $1 & $ args last;
}
Location ~ [^/] \. Php (/| $ ){
# Fastcgi_pass remote_php_ip: 9000;
Fastcgi_pass unix:/dev/shm/php-cgi.sock;
Fastcgi_index index. php;
Include fastcgi. conf;
}
Location ~ . * \. (Js | css )? $ {
Expires 7d;
Access_log off;
}
}
The core rules are as follows and must be added to the server segment:
Location/{try_files $ 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 ^ /(?! Lib/) (. *)/doku. php? Id = $1 & $ args last;
}
Location ~ . * \. (Js | css )? $ {
Expires 7d;
Access_log off;
}
Next, add a line to conf/local. php:
1
$ Conf ['userwrite'] = 2;
Finally, modify the background settings of dokuwiki, choose "background"> "management"> "Configuration Manager"> "advanced settings"> use a more clean URL. Select ". htaccess" and save the settings to view the effect.