Wordpress (single blog installation) and nginx

Abdul-Rahman Advany abdulrahman at advany.com
Thu Dec 13 17:48:33 MSK 2007


REQUEST_URI makes it work.

Everythings works great, I will write this up for future reference for
myself and others, and refer to you and this mailinglist. I will mail the
link.

Thanks for your help and nginx!,

On 12/13/07, Igor Sysoev <is at rambler-co.ru> wrote:
>
> On Thu, Dec 13, 2007 at 03:04:54PM +0100, Abdul-Rahman Advany wrote:
>
> > Works great, only know it returns a 404 error with every request :( is
> there
> > a way I can remove the header send by nginx?
>
> By the way, what method does work - REQUEST_URI or PATH_INFO ?
>
> > On 12/13/07, Igor Sysoev <is at rambler-co.ru> wrote:
> > >
> > > On Thu, Dec 13, 2007 at 09:06:05AM +0100, Abdul-Rahman Advany wrote:
> > >
> > > > Hi guys,
> > > >
> > > > I am running php with nginx, with fastcgi. But instead of heaving my
> > > urls
> > > > like www.myblog.com/index.php/bla/bla I would like
> > > > www.myblog.com/bla/bla<http://www.myblog.com/bla/bla.>
> > > >
> > > > With the setup at the end of the mail, it redirect if a file can't
> be
> > > found
> > > > to index.php, but I get the content of index.php back. (So if I go
> to
> > > > www.myblog.com/bla/bla).
> > > >
> > > > But I also have other requests that should not be rewritten
> (directories
> > > and
> > > > files in the root directory). Is this possible? to redirect only if
> > > > www.myblog.com/bla/bla doesn't exist to a normal request to the root
> > > > directory and send that to the fastcgi process?
> > >
> > > How does wordpress find what URI you request ?
> > > I know that wordpress may use REQUEST_URI (it should already set
> > > in /etc/nginx/fastcgi.conf):
> > >
> > > fastcgi_param  REQUEST_URI        $request_uri;
> > >
> > > The second way (I do not know whether Wordpress use it) is PATH_INFO:
> > >
> > >       location / {
> > >            root /var/www/blog;
> > >            error_page  404 /index.php;
> > >       }
> > >
> > >       location ~ \.php$ {
> > >            include        /etc/nginx/fastcgi.conf;
> > >            fastcgi_pass 127.0.0.1:8888;
> > >            fastcgi_param  PATH_INFO        $request_uri;
> > >
> > > fastcgi_param  SCRIPT_FILENAME  /var/www/blog/$fastcgi_script_name;
> > >       }
> > >
> > >       location ~*
> > >
> ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$
> > > {
> > >            root /var/www/blog;
> > >       }
> > >
> > >
> > > > I really love nginx, and thanks to this mailinglist I didn't need
> much
> > > help.
> > > > But most rewrite rules are written wordpress MU (multiuser) and not
> > > > wordpress redux. I just need to to rewrite all request that do not
> > > exists to
> > > > index.php and pass this to fastcgi.
> > > >
> > > > I did get this working one time.. but I can't figure out how I did
> it :S
> > > >
> > > > server {
> > > >         listen      80;  # Replace this IP and port with the right
> > > > ones for your requirements
> > > >         server_name  www.myblog.com
> > > >
> > > >         #charset koi8-r;
> > > >
> > > >         #access_log  logs/host.access.log
> > > >
> > > >         location ~*
> > > >
> > >
> ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$
> > > > {
> > > >           root /var/www/blog;
> > > >         }
> > > >
> > > >         error_page  404 /index.php;
> > > >
> > > >         location ~ \.php$ {
> > > >           include        /etc/nginx/fastcgi.conf;
> > > >           fastcgi_pass
> > > > 127.0.0.1:8888;
> > > >           fastcgi_index  index.php;
> > > >
> > > fastcgi_param  SCRIPT_FILENAME  /var/www/blog/$fastcgi_script_name;
> > > >         }
> > > >
> > > >         # deny access to .htaccess files, if Apache's document root
> > > >         # concurs with nginx's one
> > > >         #
> > > >         #location ~ /\.ht {
> > > >         #    deny  all;
> > > >         #}
> > > >
> > > >      }
> > > >
> > > >
> > > >
> > > > --
> > > > Abdul-Rahman Advany
> > > >
> > > > IM: abdulrahman at advany.com
> > >
> > > --
> > > Igor Sysoev
> > > http://sysoev.ru/en/
> > >
> > >
> >
> >
> > --
> > Abdul-Rahman Advany
> >
> > IM: abdulrahman at advany.com
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>


-- 
Abdul-Rahman Advany

IM: abdulrahman at advany.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20071213/234ac184/attachment.html>


More information about the nginx mailing list