Trying to reconcile global ip address and Vhosts
Posted
by
puk
on Super User
See other posts from Super User
or by puk
Published on 2012-10-03T05:10:45Z
Indexed on
2012/10/04
3:40 UTC
Read the original article
Hit count: 766
I have been using my local machine as a web server for a while, and I have several websites set up locally on my machine, all with similar Vhost files like the one seen here
/etc/apache2/sites-available/john.smith.com:
<VirtualHost *:80>
RewriteEngine on
RewriteOptions Inherit
ServerAdmin [email protected]
ServerName john.smith.com
ServerAlias www.john.smith.com
DocumentRoot /home/john/smith
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
CustomLog /var/log/apache2/access.log comonvhost
</VirtualHost>
then I set up the /etc/hosts
file like so for every Vhost:
192.168.1.100 www.john.smith.com john.smith.com
192.168.1.100 www.jane.smith.com jane.smith.com
192.168.1.100 www.joe.smith.com joe.smith.com
192.168.1.100 www.jimbob.smith.com jimbob.smith.com
Now I am hosting my friend's website until he gets a permanent domain. I have port forwarding set up to redirect port 80 to my machine, but I don't understand how the global ip fits into all of this. Do I for example use the following web site addresses (assume global ip is 12.34.56.789
):
12.34.56.789.john.smith
12.34.56.789.jane.smith
12.34.56.789.joe.smith
12.34.56.789.jimbob.smith
© Super User or respective owner