Wordpress (single blog installation) and nginx

Abdul-Rahman Advany abdulrahman at advany.com
Thu Dec 13 11:06:05 MSK 2007

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

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

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?

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 ~*
          root /var/www/blog;

        error_page  404 /index.php;

        location ~ \.php$ {
          include        /etc/nginx/fastcgi.conf;
          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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20071213/53e8e030/attachment.html>

More information about the nginx mailing list