Non-root install of Wordpress in an already running nginx site

Been running nginx on our server for years. php-fpm, multiple location
sections, etc., all working fine.

However, for one project we’re launching my partner wants to run a
wordpress blog from a subdirecory, i.e., example.com/ournewblog

Can anyone point me to an example of a location block for the wordpress
blog that handles all the wordpress needs while not futzing with all the
other locations or causing php problems elsewhere?

Thanks!

2012/4/11 Ian M. Evans [email protected]:

Been running nginx on our server for years. php-fpm, multiple location
sections, etc., all working fine.

However, for one project we’re launching my partner wants to run a
wordpress blog from a subdirecory, i.e., example.com/ournewblog

Can anyone point me to an example of a location block for the wordpress
blog that handles all the wordpress needs while not futzing with all the
other locations or causing php problems elsewhere?

location /ournewblog/ {
root …;
try_files $uri /ournewblog/index.php?q=$uri;
location ~ .php$ {
fastcgi_pass …

}
}

Hopefully you don’t have regex based location on server { } block.
Otherwise you can try location ~ ^/ournewblog/ instead.

On Tue, April 10, 2012 8:02 pm, Edho A. wrote:

Otherwise you can try location ~ ^/ournewblog/ instead.
I’ve always been a bit unsure of handling nginx locations so how can I
tell if I have a “regex based location”?

Most of my locations are like:

location / {
index index.shtml index.php;
}
location ~ .(shtml|php|inc)$ {
fastcgi_pass 127.0.0.1:10004;
}

start of extensionless stuff

location ~ ^/(bunch|of|site|sections)(/.*$|$) {

}
location ~ /(more|extensionless|sections)(/|$) {

}

Thanks.

On 04/10/2012 05:22 PM, Ian M. Evans wrote:

Hopefully you don’t have regex based location on server { } block.
Otherwise you can try location ~ ^/ournewblog/ instead.
I’ve always been a bit unsure of handling nginx locations so how can I
tell if I have a “regex based location”?

http://nginx.org/en/docs/http/request_processing.html

Regards,
Cliff

On 10/04/2012 8:26 PM, Edho A. wrote:

this is regex based location block. It gets higher priority when
accessing /ournewblog/index.php .

You need location ~ ^/ournewblog/ instead and put it as the first
location block (before other locations).

Thanks…I’ll give it a try.

2012/4/11 Ian M. Evans [email protected]:

Hopefully you don’t have regex based location on server { } block.
location ~ .(shtml|php|inc)$ {
fastcgi_pass 127.0.0.1:10004;
}

this is regex based location block. It gets higher priority when
accessing /ournewblog/index.php .

You need location ~ ^/ournewblog/ instead and put it as the first
location block (before other locations).

2012/4/12 Ian E. [email protected]:

Sorry, seems like location ^~ /ournewblog/ will also do the job.

On Thu, April 12, 2012 8:20 am, Edho A. wrote:

Sorry, seems like location ^~ /ournewblog/ will also do the job.

Hmm…already encountered one issue:

location ^~ /ournewblog/ {
try_files $uri /ournewblog/index.php?q=$uri;
location ~ .php$ {
fastcgi_pass 127.0.0.1:10004;
}
}

Just started the install and it duplicates the admin subdirectory links
so
we get:

http://www.example.com/ournewblog/wp-admin/wp-admin/setup-config.php

Any ideas?

Am 13.04.2012 09:14 schrieb “Ian M. Evans” [email protected]:

On Thu, April 12, 2012 8:20 am, Edho A. wrote:

Sorry, seems like location ^~ /ournewblog/ will also do the job.

Hmm…already encountered one issue:

Try

location ^~ /ournewblog/ {

try_files $uri $uri/ /ournewblog/index.php?q=$uri;