Welcome! Log In Create A New Profile

Advanced

Re: mediawiki + nginx

April 29, 2009 02:26AM
On Tue, Apr 28, 2009 at 04:45:17PM -0400, Timothy Ball wrote:

> still sorta confused about running those two together. my end goal is
> to have simple urls like:
>
> wiki.something.com/TheArticleThingie
>
> right now under my current configs i get urls that look like this:
>
> wiki.something.com/index.php/TheArticleThingie
>
> 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
> http://wiki.nginx.org/NginxMediaWiki and when i do an nginx -t it
> gives and error:
>
> --snip--snip--snip--
> 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/wiki.sunlightlabs.com.conf:22
> 2009/04/28 20:32:25 [emerg] 1172#0: the configuration file
> /etc/nginx/nginx.conf test failed
> --snip--snip--snip--
>
> --snip--snip--snip--
> server {
> listen 80;
> server_name wiki.something.com;
>
> ## http {
> root /var/www/wiki.something.com/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_pass 127.0.0.1:10000;
> }
> 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:

If you have "if ($uri" in configuration, this means that your configuraiton
is far from optimal and has hidden agendas.

location / {
try_files $uri ${uri}index.php /index.php?title=$uri;
}

location /images/ {
# empty
}

location ~ ^/index.php/(.+) {
rewrite ^/index.php/(.+) /index.php?title=$1 last;
}

location ~ .*\.php$ {
fastcgi_pass 127.0.0.1:10000;
...
}


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

mediawiki + nginx

Timothy Ball April 28, 2009 04:45PM

Re: mediawiki + nginx

mike April 28, 2009 05:01PM

Re: mediawiki + nginx

Cliff Wells April 28, 2009 05:20PM

Re: mediawiki + nginx

Igor Sysoev April 29, 2009 02:29AM

Re: mediawiki + nginx

Cliff Wells April 29, 2009 11:02AM

Re: mediawiki + nginx

Igor Sysoev April 29, 2009 02:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 222
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready