LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 958|回复: 3

多个域名的www对应同一IP,在此IP主机上又是不一样的目录.httpd.conf

[复制链接]
发表于 2008-1-7 20:19:11 | 显示全部楼层 |阅读模式
多个域名的www对应同一IP,在此IP主机上又是不一样的目录,如何处理httpd.conf,若是同一个目录用VirtualHost *:80就好了,不过对于不是同一样目录的如何处理呢。特发贴记录。
发表于 2008-1-8 21:40:44 | 显示全部楼层
多写几个Virtualhost
回复 支持 反对

使用道具 举报

发表于 2008-1-10 17:58:28 | 显示全部楼层
在httpd.conf同级目录下建立一个vhost目录,里面写每个www的virtualhost
回复 支持 反对

使用道具 举报

发表于 2008-1-10 22:14:30 | 显示全部楼层
这个是我的配置文件,你可以参考
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin postmaster@example1.com.cn
    DocumentRoot /opt/www_host/example1
    ServerName www.example1.com.cn
    ServerAlias www.example1.com
    ErrorLog logs/error_log
    CustomLog logs/example1_access_log combined
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin postmaster@example2.com.cn
    DocumentRoot /opt/www_host/example2
    ServerName www.example2.com.cn
    ErrorLog logs/hospital_error_log
    CustomLog logs/example2_access_log combined
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin postmaster@example2.com.cn
    DocumentRoot /opt/www_host/www2
    ServerName www2.example2.com.cn
    ErrorLog logs/www2_example2_error_log
    CustomLog logs/www2_example2_access_log combined
</VirtualHost>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表