Apache 配置
1.开启virtual hosts,找到这句去掉前边的#
文件:httpd.conf
Include conf/extra/httpd-vhosts.conf
2.配置httpd-vhosts.conf,看上边的include 目录就知道它在哪里拉~
去掉下边行的#
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin [test@localhost] #不太重要
DocumentRoot "E:/xampp/htdocs/example-com"
ServerName example.com
ServerAlias www.example.com admin.example.com #反正指向这个项目的域名都放在这里
ErrorLog "logs\example-error.log" #简单写法只有一个log文件,最后文件在apache/logs/里
CustomLog "logs\example-access.log" common
</VirtualHost>
#如果还有其他项目,就复制上边的,放这里,改下参数。剩下的就访问localhost啦,哪天哪个项目404了,就记得来这里加
<VirtualHost *:80>
DocumentRoot "E:/xampp/htdocs/"
ServerName localhost
ServerAlias localhost 192.168.1.2 #记得如果你需要用ip地址访问这个服务器的话,也要加上
ErrorLog "|bin/rotatelogs.exe logs/error-%y%m%d.log 8600 480" #每天生成新的log ,rotatelogs 详情请看下边介绍
CustomLog "|bin/rotatelogs.exe logs/access-%y%m%d.log 8600 480"
</VirtualHost>
Apache windows rotatelogs.exe 日志分割工具
rotatelogs [ -l ] logfile [ rotationtime [ offset ]] | [ filesizeM ]
ErrorLog "|bin/rotatelogs.exe logs/error-%y%m%d.log 8600 480"
CustomLog "|bin/rotatelogs.exe logs/access-%y%m%d.log 8600 480"
- [-l] local 使用本地时间。
- [rotationtime] 每个新增文件的间隔时间(s)。如果每天一个新的日志文件:60*60*24=8400
- [offset] 与UTC 相差的分钟数 ,默认0。+8:00 区:480
- [filesizeM] 日志文件大小,以文件大小判断是否需要新增一个日志文件
小知识课堂:UTC - 英语:Coordinated Universal Time,法语:Temps Universel Coordonné,因为英法语简写不一样,折中简称UTC