配置apache的虚拟主机

 

打开我的虚拟环境 vmware 上的 Fedora
#shutdown -r now #重启系统
$ ifconfig #查看虚拟机的ip地址
安装apache
 # 配置安装环境
./configure –prefix=/home/apache –enable-shared=max –enable-module=most
prefix 缺省是 /usr/local/apache
–enable-shared=max //所有都变成动态加载
# 设置主机映射规则 

NameVirtualHost * # 开启名称映射

# 设置通用站点
    ServerName * #映射所有域名
    DocumentRoot /home/tester/htdocs #页面文件位置
    ErrorLog /home/tester/logs/www/error_log #错误日志位置
    CustomLog /home/tester/logs/www/access_log common # 日志文件位置及规则

# 设置特定主机名的站点
    ServerName feed.test.com
    DocumentRoot /home/tester/htdocs/feed
    ErrorLog /home/tester/logs/feed/error_log
    CustomLog /home/tester/logs/feed/access_log common

# 设定特定站点 及 通配的子域名
    ServerName feeds.test.com
    ServerAlias feeds.test.com *.feeds.test.com
    DocumentRoot /home/tester/htdocs/feeds
    ErrorLog /home/tester/logs/feeds/error_log
    CustomLog /home/tester/logs/feeds/access_log common

配置log方式 使用cronolog 将文件日志分割为按天记录
需要首先安装 cronolog

LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i”" combined

CustomLog “|/usr/local/sbin/cronolog /home/apache/logs/access_log.%Y%m%d” combined

test

设置本机域名映射 以欺骗浏览器将指定的域名转向到指定的ip 
设置sys:\windows\system32\drivers\etc\hosts 文件

192.168.40.116       feed.test.com
192.168.40.116       feeds.test.com
fallseir.lee (fallseir at gmail dot com)

 

 

看完了要说点啥么?

You must be logged in to post a comment.