Pseudo-static setting rules for DokuWiki in Nginx

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.