知识库

apache配置多ip虚拟机有2种方法
2021-06-04 15:27:05
阅读()
来源:互联数据
摘要:    apache配置多ip虚拟有2种方法

apache配置多ip虚拟有2种方法


站群虚拟主机产品链接http://www.hkt4.com/dedicated/hk.html


第一种-通过设置不同的端口来配置


1创建一个目录,作为接口


2设置apche虚拟主机(不用配置虚拟目录映射)


httpd.conf开启虚拟主机配置,接着到httpd-vhosts.conf里面设置


//这里改变端口


DocumentRoot "D:/myblog" //这个就是第一步创建的接口

DirectoryIndex index.html index.htm index.php

Options FollowSymLinks

Allowoverride None

order Allow,deny

Allow from all

DocumentRoot "D:/baidu"

DirectoryIndex index.html index.htm index.php

Options FollowSymLinks

Allowoverride None

order Allow,deny

Allow from all


3-到httpd.conf文件里面修改监听端口

Listen 80

Listen 81


4-到host文件里面修改映射.登录网站时候记得加端口号。

apache配置多ip虚拟主机


第二种方法:通过ServerName配置


1创建一个目录,作为接口


2设置apche虚拟主机(不用配置虚拟目录映射)


httpd.conf开启虚拟主机配置,接着到httpd-vhosts.conf里面设置

//记得ip必须为*否则不行的


DocumentRoot "D:/myblog" //目录

ServerName www.lengai.com //域名

DirectoryIndex index.html index.htm index.php

Options FollowSymLinks

Allowoverride None

order Allow,deny

Allow from all

DocumentRoot "D:/baidu"

ServerName www.beijing.com

DirectoryIndex index.html index.htm index.php

Options FollowSymLinks

Allowoverride None

order Allow,deny

Allow from all


3重启apache。就可以了,当然要配置hosts


香港多ip虚拟主机就选用互联数据,7*24小时不间断机房现场服务,售后无忧。

0

上一篇:一文读懂什么是云服务器?
下一篇:刚买的云服务器,宝塔面板忘记密码了该怎么办?
HKT4为您的网站提供全球IDC资源
立即免费测试