Apache 虚拟主机的配置方法总结
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Apache 虚拟主机的配置方法总结:
虚拟主机
1. 在httpd.conf中找到Include conf/extra/httpd-vhosts.conf 把前面的#去除
2. 添加监听如:Listen 8080
Listen 192.168.0.100:80
3. 删除或注掉DocumentRoot "D:/Apache2.2/htdocs"
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "D:/Apache2.2/htdocs"
4. 在配置extra/httpd-vhosts.conf时,如果要保留原来httpd.conf中默认的访问目录和域名,必须为默认域名也创建一个virtualHost,样例如下(监听端口是8080):
5. httpd-vhosts.conf配置如下:
NameVirtualHost *:8080
NameVirtualHost 192.168.0.100:80
在文档底部接着添加:
ServerName njumasoft
DocumentRoot F:/php/UmasoftFrw
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Satisfy all
DirectoryIndex index.html index.php
CustomLog "logs\njumasoft-access.log" common
ErrorLog "logs\njumasoft-error.log"
ServerName mysqld
DocumentRoot D:/Apache2.2/htdocs
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Satisfy all
DirectoryIndex index.html index.php
CustomLog "logs\mysqld-access.log" common
ErrorLog "logs\mysqld-error.log"
其它设置参见:/Apache/ApacheMenu/vhosts/index.html
虚拟目录
1.找到"conf/httpd.conf" 文件,按如下示例设置:
DirectoryIndex index.html index.html.var index.php
Alias /mysql D:/Apache2.2/htdocs/phpMyAdmin
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
注:以上配置均需重启Apache