Location regexp with multiple Wordpress install

Amanager nginx-forum at nginx.us
Wed Jun 1 13:59:30 MSD 2011


I have a problem with my location rules.
I would like to generate a generic location rule for each folder that
contains a WordPress installation.

location / {
        try_files $uri $uri/ /index.html;

location /user1/ {
       try_files $uri $uri/ /user1/index.php?q=$uri&$args;

location ~* ^/(user2|user3)/ {
        try_files $uri $uri/ /$1/index.php?q=$uri&$args;

location ~ \.php$ {
        fastcgi_index index.php;
        include fastcgi_params;

If I go to localhost/user1/, I am redirected to the good Wordpress. But,
if I go to localhost/user2/ my browser downloads a file containing the
source code of index.php.
How to get it working?

Thank you.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,202924,202924#msg-202924

More information about the nginx mailing list