cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

middleware:web:nginx:conf:dokuwiki.html



Nginx

Nginx Sample Configuration of DokuWiki

sample.conf with rewrite

http://192.168.0.10/

server {
listen   80;
    server_name  sub1.example.com;
 
    access_log  /var/log/nginx/sub1.example.com.access.log;
    error_log   /var/log/nginx/sub1.example.com.error.log;
 
    #maximum file upload size is 4MB - change accordingly if needed
    client_max_body_size 4M;
    client_body_buffer_size 128k;
 
    rewrite ^(/)_media/(.*) $1lib/exe/fetch.php?media=$2 last;
    rewrite ^(/)_detail/(.*) $1lib/exe/detail.php?media=$2 last;
    rewrite ^(/)_export/([^/]+)/(.*) $1doku.php?do=export_$2&id=$3 last;
 
    location / {
        root /usr/share/nginx/sub1.example.com;
        index  index.html index.htm index.php;
        if (!-f $request_filename) {
            rewrite ^(/)(.*)?(.*)  $1doku.php?id=$2&$3 last;
            rewrite ^(/)$ $1doku.php last;
        }
    }
 
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/sub1.example.com;
    }
 
    location ~ \.php$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php index.html;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
 
    location ~ /\.ht {
        deny  all;
    }
 
    location ~ ^/(data|conf|bin|inc)/ {
        deny all;
    }
 
    location ~ ^/lib/^((?!php).)*$ {
        root html/dokuwiki/lib;
        expires 30d;
    }
 
}

sample.conf with rewrite

http://192.168.0.10/dokuwiki/

server {
    listen  80 default_server;
    server_name localhost 192.168.0.10;
 
    root    /usr/share/nginx/html;
    index   index.php index.html doku.php;
 
    #/dokuwiki/
    rewrite ^(/dokuwiki/)_media/(.*) $1lib/exe/fetch.php?media=$2 last;
    rewrite ^(/dokuwiki/)_detail/(.*) $1lib/exe/detail.php?media=$2 last;
    rewrite ^(/dokuwiki/)_export/([^/]+)/(.*) $1doku.php?do=export_$2&id=$3 last;
 
 
    location /dokuwiki/ {
        if (!-f $request_filename) {
            rewrite ^(/dokuwiki/)(.*)?(.*)  $1doku.php?id=$2&$3 last;
            rewrite ^(/dokuwiki/)$ $1doku.php last;
        }
    }
 
    location ~ \.php$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php index.html;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
 
    location ~ /\.ht {
        deny  all;
    }
 
 
    location ~ ^/dokuwiki/(data|conf|bin|inc)/ {
        deny all;
    }
 
    location ~ ^/dikuwiki/lib/^((?!php).)*$ {
        root html/dokuwiki/lib;
        expires 30d;
    }
 
}

sample.conf with rewrite

http://192.168.0.10/dokuwiki/site/

server {
    listen  80 default_server;
    server_name localhost 192.168.0.10;
 
    root    /usr/share/nginx/html;
    index   index.php index.html doku.php;
 
    #/dokuwiki/site/
    rewrite ^(/dokuwiki/site/)_media/(.*) $1lib/exe/fetch.php?media=$2 last;
    rewrite ^(/dokuwiki/site/)_detail/(.*) $1lib/exe/detail.php?media=$2 last;
    rewrite ^(/dokuwiki/site/)_export/([^/]+)/(.*) $1doku.php?do=export_$2&id=$3 last;
 
    location /dokuwiki/site/ {
        if (!-f $request_filename) {
            rewrite ^(/dokuwiki/site/)(.*)?(.*)  $1doku.php?id=$2&$3 last;
            rewrite ^(/dokuwiki/site/)$ $1doku.php last;
        }
    }
 
 
    location ~ \.php$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php index.html;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
 
    location ~ /\.ht {
        deny  all;
    }
 
    location ~ ^/dokuwiki/(data|conf|bin|inc)/ {
        deny all;
    }
 
    location ~ ^/dikuwiki/lib/^((?!php).)*$ {
        root html/dokuwiki/lib;
        expires 30d;
    }
 
}



middleware/web/nginx/conf/dokuwiki.html.txt ยท Last modified: 2017/05/06 by admin

Page Tools