On Thu, 4 Jul 2002, Randy Ong wrote:

> Dynamic IP is the solution and for having a web server
> and you need an awk/sed script/s to automatically update your Dynamic IP
> service and your servers
> configuration file when ever there is a change of IP.
>
> a simple hack/script that i have a year ago for changing IP of your
> httpd.conf
>
> #!/bin/bash
> IP=`/sbin/ifconfig ppp0| grep inet | cut -d : -f 2 | cut -d\  -f 1`
> echo $IP
> sed -e "s/NameVirtualHost 202.*:80/NameVirtualHost $IP:80/g"
> /etc/httpd/conf/httpd.conf > /etc/httpd/conf/httpd.conf2
> mv -f /etc/httpd/conf/httpd.conf2 /etc/httpd/conf/httpd.conf
> /etc/init.d/httpd restart
>
> ppp0 is you ADSL connection
> another script is to monitor if theres a change of your IP attach for
> rp-pppoe scripts

This won't be necessary if you use the virtual domain configuration
settings of apache.  I use it and it saves so much in configuration time!

VirtualDocumentRoot /home/httpd/virtual/%0/
VirtualScriptAlias  /home/httpd/virtual/%0/cgi-bin

This way, if apache receives an httpd 1.1 request, it takes the fqdn in
the URL contained in the request and matches it in a directory in
/home/httpd/virtual.  If a match is found, then the contents of the
directory is read as the documentroot of the website.  Simple, and no need
to reconfigure and restart apache.

So all you need is to update the A record of your server to point to the
current IP address you have.



\8)



_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to