发新话题
打印

[转载]如何在RedHat环境下的Apache中配置虚拟主机

[转载]如何在RedHat环境下的Apache中配置虚拟主机

信息来源:Inspiration

1. 找到Apache的配置文件,Red Hat Linux下面默认的安装在/etc/httpd/conf/httpd.conf

2.用vi打开httpd.conf,进行编辑,修改NameVirtualHost和<VirtualHost>部分,举一个简单的例子:

NameVirtualHost *:80

# www.domain.com
<VirtualHost *>
  ServerName www.domain.com
  ServerAdmin webadmin@www.domain.com
DocumentRoot /www/domain

<Directory />
   Options FollowSymLinks
   AllowOverride None
</Directory>

<Directory "/www/domainA/path">
   Options Indexes FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

<IfModule mod_dir.c>
   DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.phtml index.cgi
</IfModule>

AccessFileName .htaccess

</VirtualHost>

3. 配置完成以后执行/etc/rc.d/init.d/httpd restart,使配置生效。

更多的例子说明请看:http://www.unix-girl.com/geeknotes/apache_virtual_host_conf.html (Apache Virtual host configuration)

http://httpd.apache.org/docs/vhosts/ (Apache Virtual Host documentation)
曾几何时,有人对我说:装B遭雷劈。我说:去你妈的。于是,这个人又对我说:如果再说脏话,上帝会惩罚你的。我说:我操上帝。结论:彪悍的人生不需要上帝。

TOP

发新话题