Question regarding Nginx Configuration

dougconran nginx-forum at nginx.us
Fri Sep 30 18:37:10 UTC 2011


I have Nginx up and running but I think that the conf file could be
improved upon.

I have a single server hosting 2 domains (doma and domb).

doma is the default virtual host and supports a number of applications
all of which use Perl scripts.

domb has a separate domain name (obviously!) and supports one
application that has a Wordpress/PHP frontend plus a secure Perl
application

All doma static web pages are held in sub-directories under a root of
.../htdocs

The domb 'static' Wordpress pages (including all PHP pages) are in
.../htdocs/domb & sub-directories

All Perl scripts for both doma and domb are in .../cgi-bin
sub-directories including .../cgi-bin/domb for the secure domb apps.

As I understand it I have to have 3 server blocks:-

Block 1 - default port 80
Block 2 - domb port 80
Block 3 - domb port 443

Unfortunately it seems that I have to replicate the location ...htdocs
and cgi-bin*.pl$ blocks3 times (once for each server block) and the
/*.php$ block twice (for domb 80 and domb 443).  This, I think, is
because location blocks can only exist within server blocks.

Is it possible for location blocks to exist within the main http block
at a higher level than the server block (I've tried it and it didn't
work for me but that might have been because I had got some other
configuration statements wrong)?

TIA

Doug

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



More information about the nginx mailing list