I’m actually adding a few more blogs and will be moving to the multisite
options in wordpress and running the various blogs in subdirectories
under
/blogs, e.g.:
/blogs/blog1
/blogs/blog2
etc.
I need to be able to catch the above in either /blog or its suddirs,
since
WP installs a main blog in the /blogs dir i.e.:
On Sun, Aug 26, 2012 at 02:40:40PM -0400, Ian M. Evans wrote:
Hi there,
I realize I could create locations specific to each dir, but is there a
wildcard way to do this?
nginx locations can be “regex” or “prefix”. If you have a url prefix
which
matches all of the subdir blogs, and none of the non-subdir blogs, then
something like the following might work (I assume that all subdir blogs
start with /blogs/blog; and therefore that everything that does not
start
with that pattern belongs to the /blogs location, which remains as-is.):
==
if ($uri ~ (/blogs/[^/]*)) {
set $blogname $1;
}
If you haven’t got a clear prefix separation for the blogs, then you
might want to try a regex location; or perhaps something involving “map”
which will (probably) require enumeration all of the blogs.
If you haven’t got a clear prefix separation for the blogs, then you
might want to try a regex location; or perhaps something involving “map”
which will (probably) require enumeration all of the blogs.
Thanks so much for the example, I’ll give it a try.
Is there a specific order the locations have to go in? /blogs before
/blogs/blog or vice-versa?
On Tue, Aug 28, 2012 at 04:12:52PM -0400, Ian E. wrote:
On 27/08/2012 4:47 PM, Francis D. wrote:
Hi there,
nginx locations can be “regex” or “prefix”.
Is there a specific order the locations have to go in? /blogs before
/blogs/blog or vice-versa?
No.
“prefix” locations (location, location ^~, and location =; although
the last isn’t really a prefix) have the longest matching one chosen,
independent of the order in the config file.
That’s one of the reasons why it is good to avoid “regex” locations
if possible.
On Thu, August 30, 2012 5:27 pm, Francis D. wrote:
“prefix” locations (location, location ^~, and location =; although
the last isn’t really a prefix) have the longest matching one chosen,
independent of the order in the config file.
That’s one of the reasons why it is good to avoid “regex” locations
if possible.
Thanks for the info.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.