How can I set up Friendly URL to Nginx?
Posted
by
MKK
on Pro Webmasters
See other posts from Pro Webmasters
or by MKK
Published on 2013-10-21T03:41:57Z
Indexed on
2013/10/21
4:11 UTC
Read the original article
Hit count: 281
nginx
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 below.
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
http://foo-sample.com/wiki/start?do=login§ok=ff7d4a68936033ed398a8b82ac9
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
/etc/nginx/conf.d/rails.conf
upstream sample {
ip_hash;
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_pass 127.0.0.1:9000;
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;
}
}
/usr/share/wiki/.htaccess
## 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
</Files>
# 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
</IfModule>
© Pro Webmasters or respective owner