Chinaunix首页 | 论坛 | 博客
  • 博客访问: 121900
  • 博文数量: 25
  • 博客积分: 1436
  • 博客等级: 上尉
  • 技术积分: 256
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-17 10:10
文章分类

全部博文(25)

文章存档

2016年(1)

2015年(5)

2012年(1)

2011年(3)

2010年(6)

2009年(8)

2008年(1)

我的朋友

分类: 云计算

2015-06-17 09:42:58

1.基于IP地址的虚拟主机

ServerName 192.168.16.201:80
ServerAdmin web1@163.com
DocumentRoot "/usr/www/web1"
DirectoryIndex index.html
ErrorLog logs/web1/error_log
CustomLog logs/web1/access_log combined


ServerName 192.168.16.202:80
ServerAdmin web2@163.com
DocumentRoot "/usr/www/web2"
DirectoryIndex default.html
ErrorLog logs/web2/error_log
CustomLog logs/web2/access_log combined

2. 基于域名的虚拟主机
    当Web服务器收到访问请求时,就可以根据不同的DNS域名来访问不同的网站。它的优势就是不需要更多的IP地址,容易配置。
NameVirtualHost 192.168.16.201

ServerName :80
ServerAdmin web1@163.com
DocumentRoot "/usr/www/web1"
DirectoryIndex index.html
ErrorLog logs/web1/error_log
CustomLog logs/web1/access_log combined

ServerName
ServerAdmin web2@163.com
DocumentRoot "/usr/www/web2"
DirectoryIndex default.html
ErrorLog logs/web2/error_log
CustomLog logs/web2/access_log combined

3. 基于端口的配置
Listen 80
Listen 81

ServerName 192.168.16.201:80
ServerAdmin web1@163.com
DocumentRoot "/usr/www/web1"
DirectoryIndex index.html
ErrorLog logs/web1/error_log
CustomLog logs/web1/access_log combined


ServerName 192.168.16.201:81
ServerAdmin web2@163.com
DocumentRoot "/usr/www/web2"
DirectoryIndex default.html
ErrorLog logs/web2/error_log
CustomLog logs/web2/access_log combined


阅读(463) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~