您的位置:首页 > 运维架构 > Apache

apache 虚拟主机设置

2011-12-07 16:09 302 查看
1.打开apache配置文件apache/conf/httpd.conf(不知道apache在哪的请自行查看phpinfo()中的"Server Root" ...)

首先查找Listen 80

Listen 80 // 默认只有一行这个 可以添加多行端口让apache监听如下
Listen 8081
Listen 8082
Listen 8083


再查找# Virtual hosts

# Virtual hosts
# Include conf/extra/httpd-vhosts.conf // 把这行默认的#去掉即开启Virtual hosts


2.修改apache/conf/extra/httpd-vhosts.conf

末尾添加如下,前面监听了几个端口,后面就添加几个。

<VirtualHost *:8081>
ServerAdmin webmaster@dummy-host.com
DocumentRoot "E:/root/thisway" //8081端口网站地址
ServerName thisway
ServerAlias www.thisway.ls
ErrorLog "logs/thisway.log" // 日志文件
CustomLog "logs/thisway.log" common // 日志文件
<Directory "E:/root/thisway"> // 8081端口网站地址
Options Indexes FollowSymLinks
AllowOverride ALL
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


3.重启apache服务,访问localhost:8081即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: