安装apache:

官网:http://httpd.apache.org/download.cgi#apache24

1.wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.10.tar.gz

2.tar zxvf httpd-2.4.10.tar.gz

3.cd httpd-2.4.10  &&  ./configure ...  && make && make install

**报错APR not found,解决办法(安装apache2.2.22版本没有问题,2.4才会有这个问题)

=======================================

1.下载所需软件包:

wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz

wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz

wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

具体步骤如下:

a:解决apr not found问题>>>>>>

[root@xt test]# tar -zxf apr-1.4.5.tar.gz  
   [root@xt test]# cd  apr-1.4.5  
   [root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr  
   [root@xt apr-1.4.5]# make && make install

b:解决APR-util not found问题>>>>

[root@xt test]# tar -zxf apr-util-1.3.12.tar.gz  
   [root@xt test]# cd apr-util-1.3.12  
   [root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr
   [root@xt apr-util-1.3.12]# make && make install

c:解决pcre问题>>>>>>>>>

[root@xt test]#unzip -o pcre-8.10.zip  
   [root@xt test]#cd pcre-8.10  
   [root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre  
   [root@xt pcre-8.10]#make && make install

2.最后编译Apache时加上:

--with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr-util/ \

--with-pcre=/usr/local/pcre

=======================================

4.重新编译安装:./configure --prefix=/usr/local/apache2  --with-apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util  --with-pcre=/usr/local/pcre  --enable-so  --enable-rewrite

5.make && make install

安装完成后配置配置文件:

修改ServerName localhost.localdomain  (可通过hostname查看本机servername)

开启Include conf/extra/httpd-mpm.conf(配置prefork模式的选项,下边有介绍)

开启Include conf/extra/httpd-default.conf (下边有介绍)

Apache源码包安装的子配置文件介绍:

配置文件位置:/usr/local/apache2/etc/httpd.conf

子配置文件: /usr/local/apache2/etc/extra/*.conf

源码包安装的Apache的配置文件并不是在一个文件里,主配置文件里边只有400多行,里边加载了extra子配置文件,但默认都是注释的。

常用子配置文件介绍:

====================

1.httpd-autoindex.conf      #apache系统别名,设置别名目录在此配置文件中设置。

Alias /icons/ "/usr/local/apache2//icons/"        #通过www.domain.com/icons/访问

<Directory "/usr/local/apache2//icons">

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

</Directory>

Alias /soft/ "/www/soft/"           #通过www.domain.com/soft访问

<Directory "/www/soft/">

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

</Directory>

tips:别名目录不一定在apache根目录下,在任意目录下都可以,能够跳出网站主目录的限制,直接通.过www.domain.com/alias/访问。指定的别名目录下边一定要指定目录权限,即<Directory>。别名目录中 / 不能省略。

2.httpd-default.conf        #apache线程控制,必须开启。

Timeout 300   #超时时间

KeepAlive On  #开启线程控制(不开启的话用户访问页面会产生一个进程,访问其他页面会产生另一个进程,这样的话一个用户会产生好多个进程,会降低apache性能。开启此项,当用户访问网站时会产生一个进程,打开其他页面时会产生线程,保证了一个用户只产生一个进程。网站此项功能必须开启。)

MaxKeepAliveRequests 100   #最大线程连接数

3.httpd-info.conf    #apache状态统计

<Location /server-status>

SetHandler server-status

Order deny,allow

Deny from all

Allow from .example.com

</Location>

通过访问www.domain.com/server-status可以查看apache状态。如果页面显示not found 则需要修改目录权限,在Deny from all下加上allow from ip(允许的ip)。

4.httpd-manual.conf     #apache帮助文档

通过访问www.domain.com/manual 查看apache帮助文档,一般为英文,没用,可以到apache官网下载帮助文档。

5.httpd-languages.conf    #语言编码

要使其生效需要在主配置文件中打开,如果中文乱码不是浏览器编码的原因可能是此配置文件注释没打开。

6.httpd-mpm.conf     #最大客户端限制

<IfModule mpm_prefork_module>

StartServers          5

MinSpareServers       5

MaxSpareServers      10

MaxClients          150

MaxRequestsPerChild   0

</IfModule>

MaxClients为最大客户端数量,即进程数。里边有两个上边的<IFModule>默认mpm_worker_module生效。

最大客户端数量由服务器性能决定,可通过top命令查看当前状态,进行调整。

7.httpd-multilang-errordoc.conf       #报错页面

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var

ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

ErrorDocument 410 /error/HTTP_GONE.html.var

ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var

ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var

ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var

ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

可以到对应的页面下修改显示的报错页面。

7.其他:

httpd-ssl.confssl      #安全套接字访问   没讲,不用研究。

httpd-userdir.conf     #用户主目录配置  用的不多,不讲。

httpd-vhosts.conf虚拟主机,单独介绍。

Apache源码包安装和子配置文件介绍--update.2014-12-5的更多相关文章

  1. Apache 源码包安装

    系统:Centos 7.4 服务:Apache 2.4.33.apr 1.5.2.apr-util 1.5.4 依赖包: pcre.x86_64 pcre-devel.x86_64 openssl.x ...

  2. Apache源码包在LINUX(CENTOS6.8)中的安装(出现问题及解决)

    任务:在CENT6.8系统中安装Apache(版本为:httpd-2.4.41) 前提:由于源码包必须先编译后安装,所以必须先安装编译器:gcc 理论步骤: 1.检测gcc软件包,如果不存在则进行安装 ...

  3. 【Ubuntu 16】源码包安装Apache Httpd

    源码包安装适合初学者使用. 背景信息 APR (Apache Portable Runtime) Apache可移植运行的任务(APR)项目是创建和维护软件库,为底层平台的具体实现提供了一个可预见的和 ...

  4. CentOS源码包安装apache、nginx服务

    1.通过官网下载apache.nginx源码包 2.进入apache源码包所在目录,解压tar -xf httpd-2.4.12.tar.gz 3.cd httpd-2.4.12 4.阅读README ...

  5. Zabbix源码包安装

    Zabbix源码包安装 Cenos5.3 Basic server 安装顺序 Libxml2 Libmcrypt Zlib Libpng Jpeg:需要创建目录jpeg  /bin  /lib   / ...

  6. Linux源码包安装程序

    ★安装OS时,建议提前安装开发组件 CentOS 6:Development Tools.Server Platform DevelopmentCentOS 7:Development Tools.D ...

  7. linux 软件包安装方式选择、安装位置、源码包安装

    对外提供服务,比如apache,应使用源码包安装对内提供服务,比如gcc,只是我自己使用,使用rpm包安装 rpm包不需要指定安装位置,源码包的安装需要手动指定安装位置 rpm包默认安装位置/etc/ ...

  8. linux 源码包安装拾遗

    源码包安装和apt-get/yum的区别 安装前的区别:概念上的区别 rpm和dpkg包是经过编译过的包,并且其安装位置由厂商说了算,厂商觉得安装在哪里合适,就会装在哪里,而源码包则是没有经过编译的文 ...

  9. yum更换国内源、yum下载rpm包、源码包安装 使用介绍

    第5周第4次课(4月19日) 课程内容: 7.6 yum更换国内源7.7 yum下载rpm包7.8/7.9 源码包安装 7.6 yum更换国内源 当yum仓库的软件不好用时,例如很多yum源都是国外的 ...

随机推荐

  1. mysql-查询一天,一周,一月,一年,以及mysql的基本日期函数

    查询一天: select * from table where to_days(column_time) = to_days(now()); select * from table where dat ...

  2. SQL select结果集和return的区别

    IF EXISTS (SELECT 1 FRIN sys.objects where object_id=OBJECT_ID(N'[dbo].[testReturn_up]')AND type in ...

  3. 【CQOI2016纯净整合】BZOJ-4519~4524 (6/6)

    感觉CQOI的难度挺好的,比较贴近自身,所以拿出来做了一下 CQOI2016 Day1 T1:不同的最小割 涉及算法:最小割/分治/最小割树 思路: 最小割树裸题,直接分治最小割,记录下答案,最后排序 ...

  4. jquery插件-表单验证插件-rules

    ruels方法 1说明:查看.新增.移除一个表单控件的验证规则 2使用: 表单控件.rules(); 参数: rules() 返回元素的验证规则 rules('add',rules) 增加验证规则 r ...

  5. Hibernate学习-在线书城后台管理系统的设计

    写在前面:小编经历了昨天一晚上加今天一整天的“不吃不喝(夸张点…总之就是把时间全分享给TA了)”终于把程序的问题全部解决了,小编现在的心情十分的开森,开森,开森,Happy,话不多说,直接进入正题: ...

  6. Ext FileSystem Family、Ext2、Ext3

    catalog . 简介 . Ext2文件系统 . Ext3文件系统 . 小结 1. 简介 VFS虚拟文件系统接口和数据结构构成了一个框架,各个文件系统的实现都必须在框架内运转,但这并不要求每个文件系 ...

  7. SQL查询——同一张表的横向与纵向同时比较

    表名:student 表结构及数据: +----+--------+---------+------+------------+--------------+---------+ | id | nam ...

  8. 数据结构算法C语言实现(二)---2.3线性表的链式表示和实现之单链表

    一.简述 [暂无] 二.头文件 #ifndef _2_3_part1_H_ #define _2_3_part1_H_ //2_3_part1.h /** author:zhaoyu email:zh ...

  9. 基本概率分布Basic Concept of Probability Distributions 1: Binomial Distribution

    PDF下载链接 PMF If the random variable $X$ follows the binomial distribution with parameters $n$ and $p$ ...

  10. [转]virtualenv and virtualenvwrapper

    转自 http://liuzhijun.iteye.com/blog/1872241 virtualenv virtualenv用于创建独立的Python环境,多个Python相互独立,互不影响,它能 ...