Forum: NGINX Nginx rewrite for wordpress MU problem

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.
Glen L. (Guest)
on 2008-10-22 10:00
(Received via mailing list)
I've seen on wordpress website for the rewrite rule for nginx

But when I access the blog, it always show me http://blog.mysite.com/*
index.php*

How can I rewrite the index.php so that i just have
http://blog.mysite.com ?

Thank's in advance
Dave C. (Guest)
on 2008-10-23 11:45
(Received via mailing list)
Try this

server {

    ...

    location / {
      index index.php;
    }

    location ~ \.php$ {
       include fastcgi.conf;

       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME /path/to/root$fastcgi_script_name;
       fastcgi_pass   unix:/tmp/php-fastcgi.sock;
    }
}


Cheers

Dave
mike (Guest)
on 2008-10-23 11:52
(Received via mailing list)
On Thu, Oct 23, 2008 at 12:34 AM, Dave C. <removed_email_address@domain.invalid> 
wrote:

this location block stuff is not needed:

-   location / {
        index index.php;
-   }


note that these can be hardcoded into fastcgi.conf and even placed on
a global level
Dave C. (Guest)
on 2008-10-23 12:22
(Received via mailing list)
Cool - thanks, I didn't know that.
mike (Guest)
on 2008-10-23 12:26
(Received via mailing list)
to clarify:

i meant global server {} level

and so you don't have to hardcode it

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
Igor S. (Guest)
on 2008-10-23 12:32
(Received via mailing list)
On Thu, Oct 23, 2008 at 07:15:10PM +1100, Dave C. wrote:

> Cool - thanks, I didn't know that.

Yes, you may omit location / {}, but usually I set it up.
Endra P. (Guest)
on 2009-03-05 16:58
Hi all,

Just wondering, I'm trying to setup Wordpress MU with nginx. Have search
both wordpress, google and this forum for solution, but unable to find.

I'm having problem showing the post using permalink, it gives 404 error.

I installed Wordpress MU on a sub-folder on
/nginx/html/domain.com/blogs.

- Pages are working just fine
- Site Admin works fine

My nginx.conf is as follows:

server {
   listen       80;
   server_name  domain.com *.domain.com;

   root /nginx/html/domain.com;
   index index.php index.html index.htm;

   rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;
   if (!-e $request_filename) {
      rewrite ^.+?(/wp-.*) $1 last;
      rewrite ^.+?(/.*\.php)$ $1 last;
      rewrite ^ /index.php last;
   }

   location ~ \.php$ {
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param
SCRIPT_FILENAME/nginx/html/domain.com$fastcgi_script_name;
      include fastcgi_params;
   }
}

Can anyone tell me what I missed? Thank you in advance.
Edho P Arief (Guest)
on 2009-03-06 04:51
(Received via mailing list)
On Thu, Mar 5, 2009 at 9:58 PM, Endra P. <removed_email_address@domain.invalid>
wrote:
> - Pages are working just fine
>
>      fastcgi_param
> SCRIPT_FILENAME/nginx/html/domain.com$fastcgi_script_name;
>      include fastcgi_params;
>   }
> }
>
> Can anyone tell me what I missed? Thank you in advance.
> --
> Posted via http://www.ruby-forum.com/.
>
>

rewrite rule for the folder

location ^~ /blogs/ {
rewrite ^.*/files/(.*) /blogs/wp-content/blogs.php?file=$1;
if (!-e $request_filename) {
   rewrite ^.+?(/wp-.*) /blogs/$1 last;
   rewrite ^.+?(/.*\.php)$ /blogs/$1 last;
   rewrite ^ index.php last;
}
}

*this is just example.
*WP-MU is basically rewrite hell. I personally won't install it
together with another webapp that requires rewrites.
This topic is locked and can not be replied to.