Apache 简单实践
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Apache 简单实践相关的知识,希望对你有一定的参考价值。
# 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 #如未安装编译工具,就使用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
#这个报错暂时不用理会,编辑apache配置文件之后就会修正
# 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 #编辑虚拟主机(基于域名访问)
<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>
#下载安装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 #平滑重启
#在windows 主机上修改hosts文件
#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 $1}‘ /app/logs/www-access_20140525.log |sort|uniq -c|sort -rn #对访问IP统计排序
# vim include/ap_release.h #编辑该文件可以修改响应请求中的信息,但是需要在编译之前修改
#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
本文出自 “Daniel” 博客,请务必保留此出处http://2143754.blog.51cto.com/2133754/1782881
以上是关于Apache 简单实践的主要内容,如果未能解决你的问题,请参考以下文章
apache Apache Airflow/Cloud Composer 中多个客户端的最佳实践?