I have servers with many dozens of virtual host files so a quick generator would make life easier I'm sure.
Such a generator would need to be specific to the version and user, and perhaps the OS. As new versions of nginx are released, often new features are added, or features are changed. Many users use different paths and different system users. I typically put my virtual host files in /home/jim/$vhost/html where $vhost is obviously the name of the virtual host. Why? No real reason but it's what I do and I'm used to it. I install nginx in /usr/local/sbin/ and run it with user "nginx". Others use very different paths, users, etc. In ubuntu, if you run "sudo apt-get install nginx" it will install nginx 0.6.32 (as of now) in /usr/sbin/ and the config files will be in /etc/nginx/. The default site will be in /var/www/nginx-default/. The user will be www-data. Features available in nginx 0.7.46 are not available in nginx 06.32.
What *I* do, and FWIW, is that I have a template virtual host config file and I do a bit of cutting and pasting. In it I have my "standard" settings and some commented out lines in case I want to enable cgi or proxy php to Apache instead of using fastcgi. Then it's a simple matter of pasting in the name of the virtual host and a few other details, putting in the rewrites, and I'm good to go. But it's those details, like try_files, locations, etc, that would be extremely complicated for a generator to get right without a lot of effort put into making such a generator. And then it could be obsolete when the scope of "try_files" is changed a few months after the feature is introduced, like it was recently in version 0.7.44 after having been introduced only three months earlier in 0.7.27. See http://nginx.net/CHANGES. And that points to the issue that I touched on above. Seventeen version changes in three months is more than one a week. By my quick count there were 16 "features" added or changed in that span (along with dozens of bug fixes). That's a lot to follow with an app.
--
Jim Ohlstein
Edited 1 time(s). Last edit at 03/31/2009 10:47AM by Jim Ohlstein.