mediawiki + nginx

Timothy Ball timball at
Wed Apr 29 00:45:17 MSD 2009

still sorta confused about running those two together. my end goal is
to have simple urls like:

right now under my current configs i get urls that look like this:

which is *very close* but not quite.

To prove that i've done my share of "just google it"

i tried to cut&paste the configs from and when i do an nginx -t it
gives and error:

tina:/etc/nginx/vhosts# nginx -t
2009/04/28 20:32:25 [emerg] 1172#0: invalid number of arguments in
"rewrite" directive in /etc/nginx/vhosts/
2009/04/28 20:32:25 [emerg] 1172#0: the configuration file
/etc/nginx/nginx.conf test failed

server {
    listen 80;

##    http {
        root  /var/www/;

        location / {
            index index.php;

            if ($uri ~ "index.php/") {
                rewrite ^/index.php/(.+) /index.php?title=$1 last;

            if (!-e $request_filename) {
                rewrite ^/(.+) /index.php?title=$1 last;

        # .php5 sent to php5
        location ~ .*\.php$ {
            include /etc/nginx/fastcgi.conf;
            fastcgi_index index.php;

            if ($uri !~ "^/images/" ) {
            fastcgi_param SCRIPT_FILENAME $document_root/index.php;
            fastcgi_param SCRIPT_NAME /index.php;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param PHP_SELF /index.php;
            fastcgi_param SCRIPT_URL /index.php;
     access_log /var/log/nginx/something_wiki_access.log combined;
     error_log /var/log/nginx/something_wiki_error.log error;

##    }
# vim: set ft=nginx:


        GPG key available on
pub  1024D/511FBD54 2001-07-23 Timothy Lu Hu Ball <timball at>
Key fingerprint = B579 29B0 F6C8 C7AA 3840  E053 FE02 BB97 511F BD54

More information about the nginx mailing list