1、打开Apache配置文件“httpd.conf”,查找“#NameVirtualHost *”,把这行前面的“#”去掉。
2、在“NameVirtualHost *”这行下面,增加虚拟主机站点。示例如下:
<VirtualHost *>
ServerAdmin
DocumentRoot /export/home/newjsp
ServerName newjsp.com
ServerAlias *.newjsp.com
ScriptAlias /cgi-bin/ /export/home/newjsp/cgi-bin/
ErrorLog "| /usr/local/sbin/rotatelogs /var/log/http/newjsp-err.log 86400"
CustomLog "| /usr/local/sbin/rotatelogs /var/log/http/newjsp.log 86400" combined
</VirtualHost>
说明:
ServerAdmin 站点管理员Email地址
DocumentRoot /export/home/newjsp 站点根目录
ServerName newjsp.com 站点主机名
ServerAlias *.newjsp.com 站点别名,“*”表示任意字符
ScriptAlias /cgi-bin/ /export/home/newjsp/cgi-bin/ 执行脚本文件存放路径
ErrorLog "| /usr/local/sbin/rotatelogs /var/log/http/newjsp-err.log 86400" 错误日志控制
CustomLog "| /usr/local/sbin/rotatelogs /var/log/http/newjsp.log 86400" combined 访问日志
/usr/local/sbin/rotatelogs 是日志管理程序
/var/log/http/newjsp.log 是日志文件名
86400的单位是秒,这种写法表示每隔1天产生一个日志文件
多个站点,重复执行第2步。