1)编译安装apache 1.1)安装前准备工作,把依赖包先安装上 yum -y install gcc* make* cmake* apr* pcre* yum grouplist yum groupinstall "开发工具" 1.2)编译apache ## 每行一个参数,注意 \后面不能有空格 ./configure --prefix=/usr/local/apache2 \ --enable-so \ --enable-rewrite \ --enable-cgi \ --enable-charset-lite ./configure --help > httpd-configure.txt #可以后面详细查看 ./configure --help | tee -a httpd-configure.txt #可平替上面那条命令 #rewrite模块,动态url >>静态url, 搜索引擎友好。 http://1.1.1.1/stat?=domain.com&data?=2026 #动态url,包含问号?和& http://1.1.1.1/stat/domain.com #静态url,不包含问号和& 2) httpd.conf 重要配置项 [root@localhost ~]# cat ~/.vimrc :set nu :set ignorecase 配置 .vimrc 这样不需要每次 都set ingorecase 对搜索 httpd.conf 内容有帮助。 #ServerName www.example.com:80 DocumentRoot "/usr/local/apache2/htdocs" #Listen 12.34.56.78:80 #可配置监听多个端口 Listen 80 Listen 8000 ErrorLog "logs/error_log" 261 262 DirectoryIndex index.html index.php index.htm 263 -----> Add update process inside a scheduler Sorry, configure.pl does not support automatic add to cron yet. You can do it manually by adding the following command to your cron: /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=192.168.139.123 /usr/local/awstats/tools/awstats_updateall.pl now 2.3) 查看web页面内容和http header 查看http header方法一 ## 测试相关命令. curl -i http://192.168.139.123/test3/ #注意 -i 选项,可以查看到 http header信息,包含http status code for i in `seq 1 10` ; do curl http://192.168.139.123/ ; done #curl命令 执行10次 查看http header方法二 打开“开发者工具”的2种方法 chrome浏览器》》右键 》》 检查 》》 F12 快捷键 #注意 http status code含义 200, 304, 403, 404, 301, 302