1.apache三种工作模式

1)prefork工作模式

一个进程处理一个用户请求

稳定但是不适合高并发的生产环境

2)worker工作模式

一个进程生成多个线程

合适高并发环境但是需要考虑到线程的安全问题

3)event工作模式

支持keepalived长连接

但是不支持httpds

2.apache基本信息

主配置文件:/etc/httpd/conf/http.conf

默认监听的端口:80

https:443

listen:80

directoryindex:index.html

documentroot:/var/www/html指定网站根目录

user:apache

servername:域名

3.服务器返回状态码

200:ok请求成功

304:表示一个缓存的资源是否发生过更改

403:forbden表示客户端没有权限访问该资源

404:notfound表示客户端请求的资源不存在

500:服务器内部错误

502:代理服务器从上游服务器获取到的是伪响应

4.LAMP通信流程

linux+apache+mysql/mariadb+php

1)用户发送http请求到达httpd服务器

2)httpd解析url获取需要的资源的路径,通过内核空间读取硬盘资源,如是静态资源,则构建响应报文,发回给用户

3)如果是动态资源,将资源地址发给php解析器,解析php程序文件,解析完毕将内容发回给httpd,httpd构建响应报文,发回给用户

4)如果涉及到数据库操作,则利用php -mysql驱动,获取数据库数据,返回给PHP解析器。

5.编译安装apache

第一步:编译安装apr

1)上传相关的安装包:rz

2)解压:tar xf

3)编译:./configure - -prefix=/usr/local/apr

4)解决依赖关系:yum install gcc –y

5)继续编译:./configure - -prefix=/usr/local/apr

6)安装:make&&make install

第二步:编译安装apr -util

1)进行编译:./configure - -with -apr=/usr/local/apr - -prefix=/usr/local/apr -util#需要指定apr位置

2)安装:make&&make install

第三步:编译安装httpd

1)编译:

./configure - -prefix=/usr/local/httpd2.4

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

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

- - enable  -cache

- - enable  -deflate

- - enable  -ssl

- - enable  -rewrite

- -with -mpm=event

2)解决依赖:yum install pcre pcre-devel openssl openssl-devel –y

3)安装:make&&make install

第四步:在任何路径下执行apachectl:

[root@ken bin]#cat/etc/profile.d/httpd.sh

exportPATH=/usr/local/httpd2.4/bin:$PATH

[root@ken bin]#export/etc/profile.d/httpd.sh

-bash:export:`/etc/profile.d/httpd.sh’:notavalididentifier

[root@ken bin]#source/etc/profile.d/httpd.sh

6.基于端口和域名创建虚拟主机

基于端口:vim /etc/httpd/conf/httpd.conf

listen81

<virtualhost*:81>

directoryindex index.html

documentroot /var/www/ken1

</virtualhost>

基于域名:

<virtualhost192.168.64.4>

directoryindex index.html

documentroot /var/www/ken1

servername www.ken.com

</virtualhost>

创建网站根目录:mkdir/var/www/ken1

7.LAMP架构

linux+apache+mysql/mariadb+php

1)部署LAMP架构:yum install httpd php php -mysql mariadb-server  -y

2)启动Apache与数据库:

systemctl restart httpdmariadb

3)上传WordPress安装包并解压

4)配置数据库文件

[root@ken html]#cp wp-config-sample.php wp-config.php

[root@ken html]#vim wp-config.php

/**WordPress数据库的名称*/

define(‘DB_NAME’,‘litong’);

/**MySQL数据库用户名*/

define(‘DB_USER’,‘litong’);

/**MySQL数据库密码*/

define(‘DB_PASSWORD’,‘123’);

5)配置数据库

create database ken;

grant all on*.*to ken@’localhost’ identified by ‘123’;

Apache编译安装及LAMP架构的更多相关文章

  1. 末学者笔记--apache编译安装及LAMP架构上线

    apache介绍 一.Apache的三种工作模式 Apache一共有3种稳定的MPM模式(多进程处理模块),它们分别是prefork.worker.event.http-2.2版本的httpd默认的m ...

  2. apache编译安装 httpd 2.2 httpd 2.4

    #apache编译安装#httpd 2.2 , httpd 2.4 #!/bin/sh #apache编译安装 #httpd 2.2 , httpd 2.4 #centos #rpm -e httpd ...

  3. apache编译安装参数说明

    apache编译安装参数说明 ./configure //配置源代码树--prefix=/usr/local/apache2 //体系无关文件的顶级安装目录prefix ,也就apache的安装目录. ...

  4. LANMP系列教程之Apache编译安装CentOS7环境

      1.准备好源码包并配置好yum源,需要的源码包包括:httpd-2.4.18.apr-1.5.2.tar.gz.apr-util-1.5.4.tar.gz 2.准备用户 groupadd -r a ...

  5. Apache编译安装

    1.准备好源码包并配置好yum源,需要的源码包包括:httpd-2.4.18.apr-1.5.2.tar.gz.apr-util-1.5.4.tar.gz 2.准备用户 groupadd -r apa ...

  6. CentOS 7.4下源码编译安装配置LAMP环境详解

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

  7. Apache web服务器(LAMP架构)

    1.apache介绍 1).世界上使用率最高的网站服务器,最高时可达70%:官方网站:apache.org 2).http 超文本协议 HTML 超文本标记语言 3).URL 统一资源定位符 http ...

  8. 在CentOS6上编译安装实现LAMP(php-modules)+phpMyAdmin安装过程全记录

    php与apache协作有三种模式:CGI.modules.FastCGI. 在CGI模式下,用户请求php文件时,apache会启动响应进程,调用php处理器处理请求,然后将结果返回给客户端.用户响 ...

  9. CentOS 5.9裸机编译安装搭建LAMP

    Linux系统:CentOS 5.9,查看CentOS版本,命令如下: [root@localhost /]# cat /etc/redhat-release CentOS release 5.9 ( ...

随机推荐

  1. sql语言积累

    Persons 表: Id LastName FirstName Address City 1 Adams John Oxford Street London 2 Bush George Fifth ...

  2. MFC:OnCreate PreCreateWindow PreSubclassWindow

    OnCreate PreCreateWindow PreSubclassWindow PreCreateWindow和PreSubclassWindow是虚函数,而OnCreate是一个消息响应函数. ...

  3. (转)Spring实例化

    标签:SpringContextUtil,getBean 手动获取Bean 方法一  不用配置xml,直接java代码实现 /** * 工厂模式选择Bean类 */ public class MyBe ...

  4. python 可更改(mutable)与不可更改(immutable)对象

    在 python 中,strings, tuples, 和 numbers 是不可更改的对象,而 list,dict 等则是可以修改的对象. 不可变类型:变量赋值 a=5 后再赋值 a=10,这里实际 ...

  5. 如何制作自己的R包

    如何制作自己的R包? 摘自 方匡南 等编著<R数据分析-方法与案例详解>.电子工业出版社 R包简介 R包提供了一个加载所需代码.数据和文件的集合.R软件自身就包含大约30种不同功能的包,这 ...

  6. jQuery_插入操作

    jQuery的插入方法有很多,有内部插入,也有外部插入,每个插入方式里面还有很多种,本文一一介绍,注释在代码里,直接上代码: 代码: <!DOCTYPE html> <html> ...

  7. vue 组件 Vue.component 用法

    todo https://blog.csdn.net/weixin_41796631/article/details/82929139

  8. [python]python中**是什么

    作为运算符时 ** 在python里面表示幂运算 传递实参和定义形参(所谓实参就是调用函数时传入的参数,形参则是定义函数是定义的参数)的时候,你还可以使用两个特殊的语法:``*`` ** . 调用函数 ...

  9. Hibernate动态条件查询(Criteria Query)

    1.创建一个Criteria实例net.sf.hibernate.Criteria这个接口代表对一个特定的持久化类的查询.Session是用来制造Criteria实例的工厂. Criteria cri ...

  10. summernote(富文本编辑器)将附件与图片上传到自己的服务器(vue项目)

    1.上传图片至自己的服务器(这个官方都有例子,重点介绍附件上传)图片上传官方网址 // onChange callback $('#summernote').summernote({ callback ...