
一个ip绑定多个域名.doc
4页一个 ip 绑定多个域名:方案 1:通过端口来搞定1.在 e:\myblog 文件夹下开发一个我们的网页 news.html2.在 apache 的 httpd.conf 文件里面,打开虚拟主机选项# Virtual hosts 虚拟主机 Include conf/extra/httpd-vhosts.conf3.在 httpd-vhosts.conf 文件里面,添加一台虚拟主机:#配置我们自己的虚拟主机 DocumentRoot “E:/myblog“ ServerName DirectoryIndex news.htmlOrder deny,allow Allow from all4.在 C:\Windows\System32\drivers\etc 下的 hosts 文件中加入我们的域名:5.重启我们的 apache 服务器如果报错,说明我们的修改有问题6,打开浏览器,输入我们的:第一个域名配置成功现在我们配置第二个域名步骤很简单:1.在 e:\myblog2\文件夹下添加一个 news.html 网页2.再次在 httpd-vhost.conf 里面添加一台虚拟主机:#配置我们自己的虚拟主机 #然后还要在 httpd.conf 里面修改让 apache 监听多个端口 #配置我们自己的虚拟主机 #然后还要在 httpd.conf 里面修改让 apache 监听多个端口DocumentRoot “E:/myblog2“ #ServerName DirectoryIndex news.htmlOrder deny,allow Allow from all3.在 httpd.conf 里面,增加一个监听,让 apache 也去监听我们的 81 端口。
4.在 hosts 里面,增加一个域名:127.0.0.1 5.重启我们的 apache6,打开浏览器输入::81 此处一定要带上我们的 81 端口号码:方案二:通过 ServerName 端来区分不同的域名这个方法也很简单,就是加上 ServerName 即可。












