LAMP架构应用实战—Apache服务介绍与安装01

 

一:Apache是什么

Apache是Apache基金会开发的一个高性能、功能强大、安全可靠、灵活的开放源码的WEB服务软件

二:Apache的特点与应用场景

1、特点

功能强大、配置简单、速度快、应用广泛、性能稳定可靠,同时还可以做代理服务器或负载均衡

2、应用场景

ü  运行静态页面、图片(据说处理静态小文件能力不如nginx)

ü  结合PHP引擎运行PHP等程序,LAMP组合

ü  结合tomcat、resin运行jsp、java等程序

ü  作代理、负载均衡,rewrite规则过滤等

三:Apache的安装

一般系统默认自带安装的Apache版本相对较低,安装之前先查看下是否自带Apache服务

1、检查系统是否安装Apache服务

[root@Centos~]# rpm -qa httpd*

httpd-2.2.15-54.el6.centos.x86_64

httpd-tools-2.2.15-54.el6.centos.x86_64

2、如果没有自带Apache服务软件,可以不需要进行下面的卸载

[root@Centos~]# rpm -e --nodeps httpd-2.2.15-54.el6.centos.x86_64

warning:/etc/httpd/conf/httpd.conf saved as /etc/httpd/conf/httpd.conf.rpmsave

[root@Centos~]# rpm -e --nodeps httpd-tools-2.2.15-54.el6.centos.x86_64

3、卸载完成后检查下卸载是否成功

[root@Centos ~]# rpm -qa|grep httpd

4、创建用于存放下载的软件工具目录

[root@Centos ~]# mkdir -p /Downloads/tools

[root@Centos ~]# cd /Downloads/tools

[root@Centos tools]# ls

5、进入官方网站下载apache软件到当前目录

[root@Centos tools]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.23.tar.gz

--2016-09-11   23:44:41-- https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.23.tar.gz

Resolving mirrors.tuna.tsinghua.edu.cn... 166.111.206.63, 2402:f000:1:416:166:111:206:63

Connecting to mirrors.tuna.tsinghua.edu.cn|166.111.206.63|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 8406575 (8.0M) [application/octet-stream]

Saving to: “httpd-2.4.23.tar.gz”

100%[=============================>] 8,406,575   1.19M/s   in 6.9s

2016-09-11 23:44:49 (1.17 MB/s) - “httpd-2.4.23.tar.gz” saved [8406575/8406575]

6、查看下载的文件并解压

[root@Centos tools]# ls

httpd-2.4.23.tar.gz

[root@Centos tools]# tar zxvf httpd-2.4.23.tar.gz

.................................................................................................具体解压过程此处省略

切换到软件目录下,查看具体内容

[root@Centos tools]# cd httpd-2.4.23

[root@Centos httpd-2.4.23]# ls -ll

total 2000

-rw-r--r--.1 yumw games   13496 Apr 16  2015 ABOUT_APACHE

-rw-r--r--.1 yumw games   24689 Jun 30 01:30 acinclude.m4

-rw-r--r--.1 yumw games   65340 Jun 14 23:15 Apache-apr2.dsw

-rw-r--r--.1 yumw games   79911 Jun 14 23:15 Apache.dsw

-rw-r--r--.1 yumw games    9907 Dec 18  2009 apache_probes.d

-rw-r--r--.1 yumw games    2512 Dec 22  2008 ap.d

drwxr-xr-x.6 yumw games    4096 Sep 12 00:01 build

-rw-r--r--.1 yumw games    2644 Aug 24  2007 BuildAll.dsp

-rw-r--r--.1 yumw games    2748 Sep 28  2015 BuildBin.dsp

-rwxr-xr-x. 1 yumw games    6800 Sep 19  2012 buildconf

-rw-r--r--.1 yumw games  214576 Jun 30 22:42 CHANGES

-rw-r--r--.1 yumw games   43781 Jun 14 16:51 CMakeLists.txt

-rw-r--r--.1 yumw games   12567 Apr 17  2012 config.layout

-rwxr-xr-x. 1 yumw games 1097227 Jul  1 01:15 configure

-rw-r--r--.1 yumw games   28491 Sep  6  2015 configure.in

drwxr-xr-x.9 yumw games    4096 Sep 12 00:01 docs

-rw-r--r--.1 yumw games     403 Nov 22  2004 emacs-style

-rw-r--r--.1 yumw games    2218 Mar 23 11:53 httpd.dep

-rw-r--r--.1 yumw games    4124 Jun 12  2008 httpd.dsp

-rw-r--r--.1 yumw games    8994 Mar 23 11:53 httpd.mak

-rw-r--r--.1 yumw games   17678 Jul  1 01:15 httpd.spec

drwxr-xr-x.2 yumw games    4096 Sep 12 00:01 include

-rw-r--r--.1 yumw games    3782 May 18 01:59 INSTALL

-rw-r--r--.1 yumw games    2909 Nov 15  2011 InstallBin.dsp

-rw-r--r--.1 yumw games    4097 Nov 16  2013 LAYOUT

-rw-r--r--.1 yumw games   79070 Mar 23 11:53 libhttpd.dep

-rw-r--r--.1 yumw games   20737 Oct  3  2013 libhttpd.dsp

-rw-r--r--.1 yumw games   37816 Mar 23 11:53 libhttpd.mak

-rw-r--r--.1 yumw games   25853 Oct  2  2013 LICENSE

-rw-r--r--.1 yumw games   10452 Mar 20 23:51 Makefile.in

-rw-r--r--.1 yumw games   49943 Jun 14 23:15 Makefile.win

drwxr-xr-x.27 yumw games    4096 Sep 12 00:01 modules

-rw-r--r--.1 yumw games     550 Jan  2  2016 NOTICE

-rw-r--r--.1 yumw games   13884 Mar 20 23:51 NWGNUmakefile

drwxr-xr-x.7 yumw games    4096 Sep 12 00:01 os

-rw-r--r--.1 yumw games    4642 Jan 24  2014 README

-rw-r--r--. 1 yumw games   13317 Mar 23 11:45 README.cmake

-rw-r--r--.1 yumw games    4418 Aug 28  2014 README.platforms

-rw-r--r--.1 yumw games   10184 Oct 31  2010 ROADMAP

drwxr-xr-x.3 yumw games    4096 Sep 12 00:01 server

drwxr-xr-x.2 yumw games    4096 Sep 12 00:01 srclib

drwxr-xr-x.4 yumw games    4096 Sep 12 00:01 support

drwxr-xr-x.2 yumw games    4096 Sep 12 00:01 test

-rw-r--r--.1 yumw games    8183 Mar  1  2007 VERSIONING

查看apache介绍

[root@Centos httpd-2.4.23]# cat README

Apache HTTP Server

What is it?

-----------

The Apache HTTP Server is a powerful and flexible HTTP/1.1 compliant

web server.  Originally designed as a replacement for the NCSA HTTP

Server, it has grown to be the most popular web server on the

Internet.  As a project of the Apache Software Foundation, the

developers aim to collaboratively develop and maintain a robust,

commercial-grade, standards-based server with freely available

source code.

The Latest Version

------------------  后面的内容此处省略

介绍如何安装apache服务

[root@Centos httpd-2.4.23]# cat INSTALL

APACHE INSTALLATION OVERVIEW

Quick Start - Unix

------------------

For complete installation documentation, see [ht]docs/manual/install.html or

http://httpd.apache.org/docs/2.4/install.html

$ ./configure --prefix=PREFIX

$ make

$ make install

$ PREFIX/bin/apachectl start

更多内容可自行查看文档介绍

7、编译安装

[root@Centoshttpd-2.4.23]# ./configure \

>--prefix=/application/apache2.4.23 \

>--enable-deflate \

>--enable-expires \

>--enable-headers \

>--enable-modules=most \

>--enable-so \

>--with-mpm=worker \

>--enable-rewrite

参数说明如下:

>--prefix=/application/apache2.4.23 \ 

表示指定安装路径为/application/apache2.4.23 \,如果不指定,默认为/usr/local/apache2

>--enable-deflate \

提供对内容的压缩传输编码支持,提高传输速度,提升访问体验,生产环境中这是重要调优参数之一

> --enable-expires\

激活允许通过配置文件控制 HTTP的“Expires:”和“Cache-Control:”头内容,即对网站的图片等内容,提供在客户端浏览器缓存的设置,也是生产环境重要调优参数之一

>--enable-headers \

提供允许对HTTP请求头的控制

>--enable-modules=most \

编译安装模块 most表示包含大部分模块到httpd

>--enable-so \

激活apache服务的DSO(动态共享对象)支持,即可在以后以DSO的方式编译安装共享模块

>--with-mpm=worker \

选择apache mpm的模式为worker模式,此模式原理是更多的使用线程来处理请求,可以处理更多并发请求,也是apache调优的一个重要参数

>--enable-rewrite

提供基于URL规则的重写功能,根据已知URL地址,转换其它要访问的URL地址

checkingfor chosen layout... Apache

checkingfor working mkdir -p... yes

checkingfor grep that handles long lines and -e... /bin/grep

checkingfor egrep... /bin/grep -E

checkingbuild system type... x86_64-unknown-linux-gnu

checkinghost system type... x86_64-unknown-linux-gnu

checkingtarget system type... x86_64-unknown-linux-gnu

configure:

configure:Configuring Apache Portable Runtime library...

configure:

checkingfor APR... no

configure: error: APR not found.  Please read thedocumentation.

出现错误提示:configure: error: APR not found

解决方法如下

下载APR并进行安装

[root@Centos tools]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.5.2.tar.gz

--2016-09-12 00:56:22--  https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.5.2.tar.gz

Resolving mirrors.tuna.tsinghua.edu.cn... 166.111.206.63, 2402:f000:1:416:166:111:206:63

Connecting to mirrors.tuna.tsinghua.edu.cn|166.111.206.63|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1031613 (1007K) [application/octet-stream]

Saving to: “apr-1.5.2.tar.gz”

100%[=========================================================>] 1,031,613   1.70M/s   in 0.6s

2016-09-12 00:56:28 (1.70 MB/s) - “apr-1.5.2.tar.gz” saved [1031613/1031613]

[root@Centos tools]# ls

apr-1.5.2.tar.gz     httpd-2.4.23  httpd-2.4.23.tar.gz

[root@Centos tools]# tar zxvf apr-1.5.2.tar.gz

[root@Centos apr-1.5.2]# ./configure

--prefix=/usr/local/apr

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

Configuring APR library

Platform: x86_64-unknown-linux-gnu

checking for working mkdir -p... yes

APR Version: 1.5.2

checking for chosen layout... apr

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/Downloads/tools/apr-1.5.2':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

由于文章篇幅限制,后续内容下一下章继续介绍

LAMP架构应用实战—Apache服务介绍与安装01的更多相关文章

  1. Apache服务介绍

    http服务器程序 httpd             服务名称 apache         软件包名 特性: 高度模块化:   core + modules DSO:  Dynamic Share ...

  2. Linux+Redis实战教程_day01_Linux介绍与安装

    1.Linux介绍(了解) 1.1.Linux和Windows的区别 Linux是一款操作系统.正规开发 服务器项目部署都是放在Linux操作系统上. Windows一款操作系统,民用操作系统.娱乐. ...

  3. The server of Apache (一)——apache服务的基本安装过程

    一.为了避免端口冲突,需要卸载linux系统中以RPM方式安装的httpd ~] # rpm -qa | grep httpd ~] # rpm -e httpd --nodeps (此处nodeps ...

  4. Linux系统学习 二十、SAMBA服务—介绍、安装、端口

    1.简介 网络数据文件共享服务器 可以和Windows中的网上邻居通用 数据共享的方法: Windows中最常用的是“网上邻居”.网上邻居使用的文件系统是CIFS(通用互联网文件系统)协议进行数据共享 ...

  5. 零基础学Python-第一章 :Python介绍和安装-01.Python语言的特点

    结束

  6. CentOS 7.4搭建LAMP,LAMP:Linux、Apache、MySQL、PHP

    CentOS 7.4搭建LAMP,LAMP:Linux.Apache.MySQL.PHP. 目录: 第一部分 准备工作 第二部分 安装Apache服务 第三部分 安装MySQL服务 第四部分 搭建PH ...

  7. linux搭建apache服务并修改默认路径

    该篇文章主要讲解如何在linux服务器上搭建apache服务器,并修改指定的apache路径到自定义路径下 一:检查服务器上是否已安装apache,停止并卸载系统自带apache服务 命令为:rpm ...

  8. Linux 通过编译安装apache服务以及配置

    Linux 编译安装apache服务 一.安装 1.通过编译安装,首先需要下载源代码安装包 apache下载链接:http://httpd.apache.org/download.cgi 2.解开源代 ...

  9. Apache服务:使用 Apache 服务部署静态网站

    1.安装Apache服务 第一步:安装Apache服务程序   yum install httpd 具体流程参考https://www.cnblogs.com/python-wen/p/1016845 ...

随机推荐

  1. 第10章 使用STM32CubeMX新建工程

    STM32Cube是一项意法半导体的原创活动, 通过减少开发工作.时间和成本, 使开发者的开发工作更轻松.STM32Cube 是一个全面的软件平台,包括了ST产品的每个系列.(如,STM32CubeF ...

  2. oracle删除一个表内的重复数据,

    查询以及删除一个数据库表内的重复数据. 1.查询表中的多余的重复记录,重复记录是根据单个字段来判断的. select * from biao where id in (select id from b ...

  3. order by 排序

    [order by] 排序 asc 升序(从小到大),desc降序(从打到小) 语法: select  列名  from  表  where  条件  order by  列1,列2    asc或d ...

  4. Struts2前期(这框架目前正处于淘汰状态)

    Struts2第一天 Struts2的学习路线 1. Struts2的入门:主要是学习Struts2的开发流程(Struts2的开发流程.常见的配置.Action类的编写) 2. Struts2的Se ...

  5. ROUND()和TRUNC()函数

    ROUND(number[,decimals]) 其中:number 待做截取处理的数值: decimals 指明需保留小数点后面的位数,可选项.需要注意的是,和trunc函数不同,对截取的数字要四舍 ...

  6. cornerstone提示“SQLite-database disk image is malformed”

    当点击workingCopy时错误如下 google了一下,有是有解决的办法,可是这些都是直接使用sqlite时产生的问题. sqlite错误 The database disk image is m ...

  7. Mysql存储过程查询结果赋值到变量

    # 使用的navicat  编辑的存储过程 CREATE DEFINER=`root`@`localhost` PROCEDURE `insert_student_back`()BEGIN#定义max ...

  8. Eclipse中各种文件的注释与取消注释的快捷键

    Eclipse中各种文件的注释与取消注释的快捷键 Java文件: 注释和取消注释的快捷键都是:CTRL + / 或 Shift+Ctrl+C JS文件: 注释和取消注释的快捷键都是:CTRL + / ...

  9. MAthJax入门教程(五分钟上手)

    最近在研究,在页面中显示一些数学公式.搞得我很头疼. 据说MathJax会统一这已领域.所以去学了学.网上教程特别多.繁杂. 说的清楚的特别少. 我是这么跑通的,: 1.在官网下载代码地址为:http ...

  10. php-5.6.26源代码 - hash存储结构 - 添加

    添加 , (void *)module, sizeof(zend_module_entry), (void**)&module_ptr){ // zend_hash_add 定义在文件“php ...