摘要: 一、基于名称的虚拟主机 打开Apache2conf下的httpd.conf,查找#NameVirtualHost *:80,去掉前面的注释。添加虚拟主机www.lab.osgeo.cn,在httpd.conf的最后,添加如下代码: ServerName www...
一、基于名称的虚拟主机
打开Apache2conf下的httpd.conf,查找#NameVirtualHost *:80,去掉前面的注释。添加虚拟主机www.lab.osgeo.cn,在httpd.conf的最后,添加如下代码:
ServerName www.lab.osgeo.cn #主机名
ServerAlias lab.osgeo.cn *.lab.osgeo.cn #别名
DocumentRoot "/var/www/rsjy" #所在目录
二、增加虚拟目录
1、全局的虚拟目录设置 如httpd.conf中的/icons/
Alias /icons/ "/var/www/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
2、虚拟主机内虚拟目录设置 在之间添加上面内容,如:
ServerName www.lab.osgeo.cn #主机名
ServerAlias rsjy.com *.lab.osgeo.cn #别名
DocumentRoot "/var/www/rsjy" #所在目录
Alias /pic "/var/www/pic"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all