Forum Moderators: phranque

Message Too Old, No Replies

Are there variables for virtual host and directory blocks?

Virtual host and directory variables

         

jmichaels

11:13 pm on Oct 6, 2009 (gmt 0)

10+ Year Member



I am adding a good deal of virtual hosts. I probably should use a web based system to manage these, or build one of my own, however, for now, I am driving this with a template.

My procedure is to ssh into the machine
cp template.conf.txt lastname.firstname.conf
sudo nano -w lastname.firstname.conf

I then edit the file, save it, and apachectl graeceful. There is a lot of room for error in a path, what would be nice, is variables:

DOMAIN='example.com'
LOC='/opt/local/www/clients'
NAME='last.first'
# START example.com
<VirtualHost *:80>
DocumentRoot "$LOC/$NAME/$DOMAIN"
ServerAdmin user@example.com
ServerName $DOMAIN
ServerAlias www.$DOMAIN
DirectoryIndex index.html

# php setttings
php_admin_value open_basedir "$LOC/$NAME/$DOMAIN/:/private/var/tmp/:"
php_value engine off

<Directory "$LOC/$NAME/$DOMAIN">
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# END example.com

If this is not possible, I think I will just shell script it as
./create-vhost arg-domain arg-loc arg-name int-php

Thought I would ask the masters what they thought.

jdMorgan

2:05 am on Oct 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A 'web-based system' as you mention above would simply... shell script it. :)

Jim