1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 一个IP绑定多个域名(虚拟主机)设置方法

一个IP绑定多个域名(虚拟主机)设置方法

时间:2022-04-12 00:10:11

相关推荐

一个IP绑定多个域名(虚拟主机)设置方法

1.事先建立两个域名站点

分别建立web1和web2站点,分别建立主页面web1.html和web2.html;

2.在httpd.conf文件中启用httpd-vhosts.conf

去掉#,即

#Virtual hosts (虚拟主机)Include conf/extra/httpd-vhosts.conf

3.设置http-vhosts.conf文件(路径:X:/ApacheX.X/conf/extra/http-vhosts.conf)

添加以下内容:

#配置虚拟主机<VirtualHost*:80>DocumentRoot "d:/web1"ServerName#配置欢迎首页面DirectoryIndexweb1.htmlindex.html index.htm index.php<Directory />Options FollowSymLinks#不许别人修改网站页面AllowOverride None#设置访问权限Order allow,denyAllow from all</Directory></VirtualHost>#配置虚拟主机<VirtualHost*:80>DocumentRoot "d:/web2"ServerName#配置欢迎首页面DirectoryIndexweb2.htmlindex.html index.htm index.php<Directory />Options FollowSymLinks#不许别人修改网站页面AllowOverride None#设置访问权限Order allow,denyAllow from all</Directory></VirtualHost>

4.在hosts文件中添加我们的ip和主机映射关系(路径:c:/windows/system32/drivers/etc/hosts)

在 127.0.0.1 localhost下添加如下地址

127.0.0.1 127.0.0.1

配置完成。

现在就可以在同一个ip下访问两个域名(和)站点了。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。