# uname-rm #检查内核版本
2.6.32-358.el6.x86_64 x86_64
# cat/etc/redhat-release #查看发行版本
CentOS Release 6.4 (Final)
# rpm-qa gcc gcc-c++ #检查是否安装编译工具
Gcc-c++-4.4.7-3.el6.x86_64
Gcc-4.4.7-3.el6.x86_64
# yum Isntall gcc gcc-c++ -y #如未安装编译工具, install with Yum
#wget http://mirrors.aliyun.com/apache/httpd/httpd-2.2.31.tar.gz #下载apache
#tar XF httpd-2.2.31.tar.gz #解压
#cd httpd-2.2.31 #进入解压目录
#./configure--prefix=/application/apache \ #编译
>--enable-deflate \
>--enable-expires \
>--enable-headers \
>--enable-modules=most \
>--enable-so \
>--with-mpm=worker \
>--enable-rewrite
# Make && make install
# ln-s/application/apache2.2.31//application/apache #创建一个软连接
#mkdir/var/html/{www,bbs}-P #准备测试html
#for name in www bbs;do echo "http:/$name. rosedata.com" >/var/html/$name/index.html;done
#/application/apache/bin/apachectl start #启动apache服务
Httpd:apr_sockaddr_info_get () failed for client132
Httpd:could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1 for ServerName
#这个报错暂时不用理会, the Apache configuration file will be modified after editing
# vim/application/apache/conf/httpd.conf #修改配置文件
Include conf/extra/httpd-mpm.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-default.conf
ServerName 127.0.0.1
<directory "/var/html" >
Options-indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
# vim/application/apache/conf/extra/httpd-vhosts.conf #编辑虚拟主机 (domain-based access)
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/html/www" #
ServerName www.rosedata.com
Serveralias rosedata.com
Errorlog "Logs/dummy-host.example.com-error_log"
Customlog "Logs/dummy-host.example.com-access_log" common
</VirtualHost>
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/html/bbs"
ServerName bbs.rosedata.com
Errorlog "Logs/dummy-host2.example.com-error_log"
Customlog "Logs/dummy-host2.example.com-access_log" common
</VirtualHost>
# Download Install cronolog-1.6.2.tar.gz
#tar XF cronolog-1.6.2.tar.gz
#cd cronolog-1.6.2
#./configure
#make && make Install
# vim/application/apache/conf/extra/httpd-vhosts.conf #编辑修改log配置
Errorlog "|/usr/local/sbin/cronolog Logs/wwww-error_%y%m%d.log"
Customlog "|/usr/local/sbin/cronolog/application/apache/logs/www-access_%y%m%d.log" combined
#/application/apache/bin/apachectl Graceful #平滑重启
To modify the Hosts file #在windows host
#C: \windows\system32\drivers\etc\hosts
192.168.234.131 www.rosedata.com bbs.rosedata.com
# More/application/apache/logs/www-access_20160525.log #查看访问log
# awk ' {print $} '/app/logs/www-access_20140525.log |sort|uniq-c|sort-rn #对访问IP统计排序
# vim include/ap_release.h #编辑该文件可以修改响应请求中的信息, but needs to be modified before compiling
#define Ap_server_basevendor "Apache software Foundation"
#define Ap_server_baseproject "Apache HTTP SERVER"
#define AP_SERVER_BASEPRODUCT "Apache"
#define Ap_server_majorversion_number 2
#define Ap_server_minorversion_number 2
#define Ap_server_patchlevel_number 31
#define Ap_server_devbuild_boolean 0
This article is from the "Daniel" blog, so be sure to keep this source http://2143754.blog.51cto.com/2133754/1782881
Apache Simple Practice