Welcome! Log In Create A New Profile

Advanced

Re: Location regexp with multiple Wordpress install

June 01, 2011 06:10AM
On Wed, Jun 01, 2011 at 05:59:30AM -0400, Amanager wrote:
> Hello,
>
> 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_pass 127.0.0.1:9000;
> 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?

This is why I do not like regex locations - you have always to watch
over order of these locations. In this case you should place
"location ~ \.php$" before "location ~* ^/(user2|user3)/".
You will use only usual locations, you can place it in any order.


--
Igor Sysoev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Location regexp with multiple Wordpress install

Amanager June 01, 2011 05:59AM

Re: Location regexp with multiple Wordpress install

Igor Sysoev June 01, 2011 06:10AM

Re: Location regexp with multiple Wordpress install

Amanager June 01, 2011 07:35AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 289
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready