Relative document root to configuration file

Kornél Schadl neil at krnl.hu
Tue Jun 21 00:36:25 MSD 2011


Any advise on this?

Kornel

On Mon, Jun 13, 2011 at 2:52 AM, Kornél Schadl <neil at krnl.hu> wrote:

> I've had to following problem:
>
> I'm using svn/git for web based projects, and all projects contain an
> nginx.conf with specific configurations for the virtualhosts it
> contains. After updating code on the production server, all projects
> are located in different directories:
> project1 is in /var/www/project1, project2 is in /var/www/project2, etc.
>
> In the main nginx configuration file (let's say
> /usr/local/nginx/conf/nginx.conf) I include /var/www/*/nginx.conf. In
> the virtualhosts' configuration file I specify document roots:
> project1's conf file has a line "root /var/www/project1/web;",
> project2's has a line "root /var/www/project2/web;".
>
> On the development machine I work with, projects are on different
> locations (/home/krnl/projects/project1, /home/krnl/projects/project2,
> etc). Because of the root directive I have to share different copies
> of the projects' nginx.conf file on the production server and a
> different copy on my development host).
>
> I created a patch, where if the root directive of a virtualhost starts
> with '.' it finds the full path of the document root relative to the
> configuration file's location (and not relative to the main
> configuration file's location), so I can have the same version of
> projects' nginx.conf on both hosts: "root ./web";
>
> Until this I had: "root /var/www/project1/web;" on production server
> and "root /home/krnl/projects/project1/web;" on development host. Now
> I have "root ./web;" on both.
>
> I tested it on linux and osx. Can I contribute the patch? If so, how
> should I do this?
>
> Thanks,
> Kornel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-devel/attachments/20110620/fe07efa9/attachment.html>


More information about the nginx-devel mailing list