Welcome! Log In Create A New Profile

Advanced

Relative document root to configuration file

Kornél Schadl
June 12, 2011 08:54PM
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

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

Relative document root to configuration file

Kornél Schadl 3386 June 12, 2011 08:54PM

Re: Relative document root to configuration file

Kornél Schadl 1342 June 20, 2011 04:38PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 260
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