潮男公社

数码 导航
潮男公社 > 数码 > 电脑 > 正文

关于apache配置多ip虚拟机2种方法的分享

编辑:首席新闻菌2022-09-28 18:09:50

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

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文件里面修改映射.登录网站时候记得加端口号。

第二种方法:通过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

fqj

展开更多
标签: 虚拟机
推荐信息
相关阅读
热门视频
精彩专题
热点推荐
取消