Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2002 10:34:00 -0400 (EDT)
From:      "Gary D. Margiotta" <gary@tbe.net>
To:        Mark Johnston <mjohnston@skyweb.ca>
Cc:        'Odhiambo Washington' <wash@wananchi.com>, freebsd-isp@freebsd.org
Subject:   Re: Scripts to Manage Virtual Hosts
Message-ID:  <Pine.BSF.4.21.0207121029090.45401-300000@thud.tbe.net>
In-Reply-To: <001b01c229af$0a181040$3e0fa8c0@skycable.int>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-1250368736-1026484440=:45401
Content-Type: TEXT/PLAIN; charset=US-ASCII

I started writing some perl scripts which I use to add virtualhosts and
redirects to separate config files.  I didn't like the idea of editing the
httpd.conf directly, so I made use of the ResourceConfig directive, and
created 2 files called virtualhosts.conf and redirects.conf which apache
pulls in when started.

The scripts are currently only able to add entries, and not remove them,
but should be able to be easily enough modified to include that, I just
haven't had the time to finish them up.  I want to eventually hook up the
scripts to keep the info in a database for much easier organization and
manipulation of domains, but again, lack of time.

You'll notice that it also makes a call to a shell script that gets run to
ifconfig the virtual IPs on the host interface.  I also run that before I
restart apache to make sure the new IP takes effect.

-Gary

Running Windows is kinda like playing blackjack:
User stays on success, reboots on failure


> -----Original Message-----
> From: owner-freebsd-isp@FreeBSD.ORG
> [mailto:owner-freebsd-isp@FreeBSD.ORG] On Behalf Of Odhiambo Washington
> Sent: Friday, July 12, 2002 8:51 AM
> To: FBSD-ISP
> Subject: Scripts to Manage Virtual Hosts
> 
> 
> [ I sent this to -questions but got no help ;) ]
> 
> 
> Hello Users,
> 
> I believe someone already had written a script that can be used to
> manipulate
> httpd.conf to add/remove virtual host entries.
> I sincerely believe that this is somewhere so I don't have to start
> agonizing
> about re-inventing the wheel.
> Could someone kindly point me to where one is located, better even share
> with me
> what they have ;-)
> 
> 
> -Wash
> 
> -- 
> Odhiambo Washington  <wash@wananchi.com>    "The box said 'Requires
> Wananchi Online Ltd.  www.wananchi.com      Windows 95, NT, or better,'
> Tel: 254 2 313985-9   Fax: 254 2 313922     so I installed FreeBSD."   
> GSM: 254 72 743 223   GSM: 254 733 744 121  This sig is McQ!  :-)
> 
> 
> The light at the end of the tunnel is the headlight of an approaching
> train.
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-isp" in the body of the message
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-isp" in the body of the message
> 

--0-1250368736-1026484440=:45401
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="vhost.pl"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.4.21.0207121034000.45401@thud.tbe.net>
Content-Description: 
Content-Disposition: attachment; filename="vhost.pl"

IyEvdXNyL2xvY2FsL2Jpbi9wZXJsDQoNCnVzZSBzdHJpY3Q7DQp1c2Ugd2Fy
bmluZ3M7DQp1c2UgQ0dJIHF3KDpzdGFuZGFyZCk7DQoNCm15ICRkb21haW47
DQpteSAkZG9tYWluX2lwOw0KbXkgJHNlcnZlcm5hbWU7DQpteSAkc2VydmVy
YWRtaW47DQpteSAkZG9jdW1lbnRyb290Ow0KbXkgJGRvbWFpbnR5cGU9InZp
cnR1YWxob3N0IjsNCg0KJGRvbWFpbj1wYXJhbSgiZG9tYWluIik7DQp1bmxl
c3MgKCRkb21haW4pew0KICBwcmludCAiUGxlYXNlIGVudGVyIHRoZSBkb21h
aW4gbmFtZSB5b3Ugd2FudCB0byBhZGQ6XG4iOw0KICAkZG9tYWluPTxTVERJ
Tj47DQogIGNob21wICRkb21haW47DQp9DQoNCiRkb21haW5faXA9cGFyYW0o
ImlwIik7DQp1bmxlc3MgKCRkb21haW5faXApew0KICBwcmludCAiUGxlYXNl
IGVudGVyIHRoZSBJUCBmb3IgdGhpcyBkb21haW46XG4iOw0KICAkZG9tYWlu
X2lwPTxTVERJTj47DQ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nLnNoIikgb3IgZGllICJDb3VsZG4n
dCBvcGVuIGZpbGU6ICQhIjsNCg0KcHJpbnQgTkVUQ09ORklHIDw8ImFkZHJl
c3NlcyI7DQoNCmlmY29uZmlnIGZ4cDAgJGRvbWFpbl9pcCBhbGlhcyBuZXRt
YXNrIDI1NS4yNTUuMjU1LjI1NQ0KZWNobyAtbiAnICRzZXJ2ZXJuYW1lJw0K
DQphZGRyZXNzZXMNCg0KY2xvc2UgKE5FVENPTkZJRykgb3IgZGllICJDb3Vs
ZG4ndCBjbG9zZSBmaWxlOiAkISI7DQoNCm9wZW4gKERPTUFJTkxJU1QsICI+
Pi91c3IvbG9jYWwvYXBhY2hlL2h0ZG9jcy9hZG1pbi9kb21haW5fbGlzdCIp
IG9yIGRpZSAiQ291bGRuJ3Qgb3BlbiBmaWxlOiANCiQhIjsNCg0KcHJpbnQg
RE9NQUlOTElTVCAiJGRvbWFpbl9pcCwkc2VydmVybmFtZSwkZG9tYWludHlw
ZVxuIjsNCg0KY2xvc2UgKERPTUFJTkxJU1QpIG9yIGRpZSAiQ291bGRuJ3Qg
Y2xvc2UgZmlsZTogJCEiOw0KDQoNCnByaW50IGhlYWRlcigpOw0KcHJpbnQg
IiRzZXJ2ZXJuYW1lIGVudGVyZWQgd2l0aCBhbiBJUCBvZiAkZG9tYWluX2lw
XG4iOw0K
--0-1250368736-1026484440=:45401
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="redirect.pl"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.4.21.0207121034001.45401@thud.tbe.net>
Content-Description: 
Content-Disposition: attachment; filename="redirect.pl"

IyEvdXNyL2xvY2FsL2Jpbi9wZXJsDQoNCnVzZSBzdHJpY3Q7DQp1c2Ugd2Fy
bmluZ3M7DQp1c2UgQ0dJIHF3KDpzdGFuZGFyZCk7DQoNCm15ICRkb21haW5f
aXA7DQpteSAkbmV3X3BhdGg7DQpteSAkc2VydmVybmFtZTsNCm15ICRkb21h
aW50eXBlPSJy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FVENPTkZJRywg
Ij4+L3Vzci9sb2NhbC9iaW4vbmV0Y29uZmlnLnNoIikgb3IgZGllICJDb3Vs
ZG4ndCBvcGVuIGZpbGU6ICQhIjsNCg0KcHJpbnQgTkVUQ09ORklHIDw8ImFk
ZHJlc3NlcyI7DQoNCmlmY29uZmlnIGZ4cDAgJGRvbWFpbl9pcCBhbGlhcyBu
ZXRtYXNrIDI1NS4yNTUuMjU1LjI1NQ0KZWNobyAtbiAnICRzZXJ2ZXJuYW1l
Jw0KICANCmFkZHJlc3Nlcw0KICANCmNsb3NlIChORVRDT05GSUcpIG9yIGRp
ZSAiQ291bGRuJ3QgY2xvc2UgZmlsZTogJCEiOw0KDQpvcGVuIChET01BSU5M
SVNULCAiPj4vdXNyL2xvY2FsL2FwYWNoZS9odGRvY3MvYWRtaW4vZG9tYWlu
X2xpc3QiKSBvciBkaWUgIkNvdWxkbid0IG9wZW4gZmlsZTogDQokISI7DQoN
CnByaW50IERPTUFJTkxJU1QgIiRkb21haW5faXAsJHNlcnZlcm5hbWUsJGRv
bWFpbnR5cGVcbiI7DQoNCmNsb3NlIChET01BSU5MSVNUKSBvciBkaWUgIkNv
dWxkbid0IGNsb3NlIGZpbGU6ICQhIjsNCg0KcHJpbnQgaGVhZGVyKCk7DQpw
cmludCAiJHNlcnZlcm5hbWUgd2FzIHJlZGlyZWN0ZWQgdG8gJG5ld19wYXRo
IjsNCg==
--0-1250368736-1026484440=:45401--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0207121029090.45401-300000>