nginx rewrite for wikkawiki
Posted
by
Hans
on Server Fault
See other posts from Server Fault
or by Hans
Published on 2011-11-27T12:18:12Z
Indexed on
2011/11/27
17:55 UTC
Read the original article
Hit count: 216
Just setup WikkaWiki on my server, I have been trying to have the links go from wiki.mysite.info/wikka.php?wakka=Start
into wiki.mysite.info/DotMG
.
I tried following their guide at http://docs.wikkawiki.org/ModRewrite, however it seems incomplete and outdated. Furthermore, as of version 1.3.2
base_url
isn't even manually configurable from the wikka.config.php
file.
I am using version 1.3.2
of WikkaWiki. My nginx virtual hosts file contains:
server {
listen 80;
server_name wiki.mysite.info;
root /usr/share/nginx/wikka/;
access_log /usr/share/nginx/.access/wikka;
error_log /usr/share/nginx/.error/wikka error;
location / {
index index.php;
try_files $uri $uri/ @wikka;
}
location @wikka {
rewrite ^(.*/[^\./]*[^/])$ $1/ last;
rewrite ^(.*)$ /wikka.php?wakka=$1 last;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
Thus far it works, I can go to wiki.mysite.info/APage
and it'll display that page, however it doesn't work on all pages, sometime the browser simply downloads the page (For some reason it always downloads the Start
page).
Also when I go to wiki.mysite.info/
it downloads the wikka.php
file...
Furthermore, the links on the wiki have the wikka.php?wakka=
so whenever I navigate around the wiki, it goes back to being wiki.mysite.info/wikka.php?wakka=APage
.
I think something is wrong with my rewrite
but I can't say for sure.
Contents of the fastcgi_params
:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $server_https;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
© Server Fault or respective owner