Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm trying to use dokuwiki with its friendly URL on Nginx.

The problem that I'm facing is, it doesn' show correct path to any link (even stylesheet, and images) on every page.

It looks that paths are missing wiki/ part. If I click on the image and show its destination, it shows this URL: http://foo-sample.com/lib/tpl/dokuwiki/images/logo.png.
But it has to be this one: http://foo-sample.com/wiki/lib/tpl/dokuwiki/images/logo.png.

And login URL is not working either. If I click on login link, it takes me to
and it says 404 Not Found.

I took a look at this https://www.dokuwiki.org/rewrite#nginx
and tried as much as possible. However it still doesn't work.

Here's my conf files. How can I fix this problem? dokuwiki is set in /usr/share/wiki.


upstream sample {
    server unix:/var/run/unicorn/unicorn_foo-sample.sock fail_timeout=0;

server {
    listen 80;
    server_name foo-sample.com;
    root /var/www/html/foo-sample/public;

    location /wiki {
        alias /usr/share/wiki;
        index doku.php;

    location ~ ^/wiki.+\.php$ {
        fastcgi_index   doku.php;
        fastcgi_split_path_info ^/wiki(.+\.php)(.*)$;
        fastcgi_param   SCRIPT_FILENAME /usr/share/wiki$fastcgi_script_name;
        include         /etc/nginx/fastcgi_params;


## Enable this to restrict editing to logged in users only

## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks

## make sure nobody gets the htaccess files
<Files ~ "^[\._]ht">
    Order allow,deny
    Deny from all
    Satisfy All

# Uncomment these rules if you want to have nice URLs using
# $conf['userewrite'] = 1 - not needed for rewrite mode 2

# Not all installations will require the following line.  If you do, 
# change "/dokuwiki" to the path to your dokuwiki directory relative
# to your document root.

# If you enable DokuWikis XML-RPC interface, you should consider to
# restrict access to it over HTTPS only! Uncomment the following two
# rules if your server setup allows HTTPS.
RewriteCond %{HTTPS} !=on
RewriteRule ^lib/exe/xmlrpc.php$      https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

<IfModule mod_geoip.c>
GeoIPEnable On
    Order deny,allow
    deny from all
        SetEnvIf GEOIP_COUNTRY_CODE JP AllowCountry

        Allow from .googlebot.com
        Allow from .yahoo.net
        Allow from .msn.com

        Allow from env=AllowCountry
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.