Forum: NGINX mediawiki + nginx

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eb12d270ef7fc529c3e49038bfe7f5a0?d=identicon&s=25 Timothy Ball (Guest)
on 2009-04-28 22:54
(Received via mailing list)
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:
--snip--snip--snip--

--timball
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 Michael Shadle (Guest)
on 2009-04-28 23:10
(Received via mailing list)
On Tue, Apr 28, 2009 at 1:45 PM, Timothy Ball <timball@gmail.com> wrote:
>
> 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:
>

this is all i have:

        rewrite ^/wiki/([^?]*)(?:\?(.*))?
/mediawiki/index.php?title=$1&$2 last;
        rewrite ^/wiki /mediawiki/index.php last;

of course, that assumes

a) mediawiki is installed in /mediawiki
b) your "public" prefix is /wiki

You want no /wiki in the mix, so I am not sure how that would work
exactly. I would think it might become a circular rewrite.

You could take out /wiki in my example and try it out.

try_files would be another one to try, but that won't work; mediawiki
wants the index.php?title= stuff in there.
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-04-28 23:27
(Received via mailing list)
On Tue, 2009-04-28 at 16:45 -0400, Timothy Ball wrote:
>
> 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

Please try the second example on that page and let me know how that
works.   That's the config I use for the Nginx wiki itself, so I expect
it works =)

Cliff
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-04-29 08:36
(Received via mailing list)
On Tue, Apr 28, 2009 at 04:45:17PM -0400, Timothy Ball wrote:

>
> 2009/04/28 20:32:25 [emerg] 1172#0: the configuration file
>
>         }
>             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;
           ...
       }
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-04-29 08:39
(Received via mailing list)
On Tue, Apr 28, 2009 at 02:20:32PM -0700, Cliff Wells wrote:

> > 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
>
> Please try the second example on that page and let me know how that
> works.   That's the config I use for the Nginx wiki itself, so I expect
> it works =)

Please change this ugly stuff:

  location ~ .*\.php5?$ {
    include       fastcgi.conf;
    fastcgi_index index.php;
    if ( $uri !~ "^/images/" ) {
      fastcgi_pass  127.0.1.1:1026;
    }
  }

to something like this:

  location ~ \.php5?$ {
       fastcgi_pass  127.0.1.1:1026;
       include       fastcgi.conf;
  }

  location /images/ {
  }
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-04-29 17:10
(Received via mailing list)
On Wed, 2009-04-29 at 10:29 +0400, Igor Sysoev wrote:
> > >    wiki.something.com/index.php/TheArticleThingie
> > it works =)
>
> to something like this:
>
>   location ~ \.php5?$ {
>        fastcgi_pass  127.0.1.1:1026;
>        include       fastcgi.conf;
>   }
>
>   location /images/ {
>   }
>

I've just removed the entire first example.   I don't know that it's
worked for anyone.

Cliff
This topic is locked and can not be replied to.