试图协调全局IP地址和Vhosts


1

我一直在使用我的本地计算机作为Web服务器,我在我的机器上本地设置了几个网站,所有这些网站都有类似的Vhost文件。

/etc/apache2/sites-available/john.smith.com:

<VirtualHost *:80>
RewriteEngine on
RewriteOptions Inherit

ServerAdmin www-data@john.smith.com
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>

然后我设置了 /etc/hosts 对于每个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

现在我正在托管我朋友的网站,直到他获得永久域名。我有端口转发设置将端口80重定向到我的机器,但我不明白全局IP如何适应所有这些。我是否使用以下网站地址(假设全球IP是 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
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.