欢迎各位兄弟 发布技术文章
这里的技术是共享的
mysql 的
数据类型
定长:
char()
binary()
变长
varchar()
varbinary()
数值型
精确
INT
DECIMAL
近似
FLOAT
DOUBLE
日期时间型
DATE
TIME
DATETIME
STAMP
PHP:脚本编程语言,php解释器
WebApp:面向对象的特性
php3.0的时候 Zend引擎,执行过程分成了两段
第一段: 词法分析,语法分析,编译为Opcode
第二段: 执行Opcode
Opcode的转换是动态进行的,第一次访问时,由Zend引擎转换为Opcode,而后执行Opcode, 第二次执行同一个脚本的时候,就会执行已经编译好的Opcode,所以速度会快;;;;但是不同php进程之间,无法共享Opcode,而且Opcode是放在内存中的,php进程结束的话(或关机)php进程很可能从内存中清除Opcode,,,,为了避免自身清除Opcode,并且为了实现不同的php进程之间共享Opcode,引入了php的缓存加速器,
PHP 缓存器:
APC
aAccelerator
XCache 支持最新版本的php,而且在生产环境中被广泛使用
还有其它的,
PHP解释器-->MySQL,如何交互?
PHP程序, (比如 bash: a.sh 让bash执行的时候,才能跑起来)
php解释器或php服务器本身没有跟mysql交互的能力,真正跟mysql交互的是php程序
php53-mysql 就是 php连接mysql的驱动,
httpd 处理的是静态内容 如果是用户请求的php, httpd就会通过三种方式的一种交给php去执行
httpd+php:
CGI httpd 生成 销毁cgi进程,(执行完毕就销毁)
Module 把php直接编译成httpd的模块,它自己不能独立执行,当httpd用到php功能的时候,它才会被装载执行
httpd 自身内部加载模块来运行php,不需要启动一个新进程
FastCGI/fpm (FastCGI或者叫fpm)
php服务器提供执行php脚本的cgi进程(而且是空闲进程) 有人请求index.php的时候,后端php服务器提供php进程
php服务器 守护进程 Daemon , 可以使用 service start启动起来,监听在某个套接字上(Socket) ,(本来默认是 以Module化方式运行的,不启动php服务器,不会监听端口,) 默认监听在9000端口上,
jpg 2.mp4 3.css 不需要php(java,asp)去执行,服务端返回 它们,让客户端去执行,服务器端不执行 1.jpg 2.mp4 3.css 算web对象吧
httpd 有好多模块, 把php做成模块比较复杂,所以性能不太好,
用户请求动态内容,未必跟mysql数据库打交道,
这三个可以位于不同的主机上,只要通过 tcp/ip协议来通信就可以了
不同服务器的话,要通过网线传数据,涉及大量的io操作,网速慢的话,性能就差
放在同一台主机上,本机内部就可以完成交互了
看请问规模,请求少,放在同一台主机没有任何问题,
如果请求多的话,就得分层次来实现
web服务器 应用程序服务器(php服务器) 数据库服务器
静态内容理论上可以交给后端 应用程序服务器来执行,只不过,它不需要执行后端应用程序服务器罢了
300个请求 有50个是php请求,只有3个请求是查数据库的
php服务器先到 XCache里面看有没有Opcode,有的话,直接从 XCache里面取Opcode进行执行php,,,,,没有的话,才编译执行php (编译速度慢,是需要消耗时间的)
静态内容的响应速度比动态内容的响应速度要快得多得多
一个httpd服务器,512M内存,请求phpmyadmin的页面,做压力测试,一般来讲,能同时响应500个请求,算足够快了,
同样的内容,做成静态的,不让它执行php,(把php的执行结果缓存下来,让httpd直接处理,一般来讲,1秒钟之内,响应10000个请求很轻松,) 动态内容很灵活,很好用,但是代价是非常大的
新闻页面php程序,
一个新闻内容,把php的执行结果(不是php的编译结果),生成的静态内容,返回给httpd缓存下来,httpd返回给客户端
第二次有人访问同一内容时,就直接把httpd缓存的结果返回给客户端
这种机制,就叫做动态内容的静态化
通过这种机制,将大量的动态内容缓存为静态内容就足以实现服务器性能非常高
(像淘宝,同时5000万人访问,一个服务器只能同时500人,那得50万台服务器)
(淘宝有一个团队,专门负责将动态内容静态化的,经过灵活的策略设计以后,97%的内容都可以实现缓存,直接缓存为静态内容,静态化的结果就是把内容直接缓存在cdn当中,直接放在用户的家门口,所以用户访问特别的快)
LAMP
httpd
php53
php53-mysql
mysql-server
LAMP 最需要我们去定制, 因为官方提供,我们可能不需要,,,我们需要的官方可能没提供
手动配置编译安装这三种平台 LAMP:
Linux Apache MySQL PHP(Python,Perl)
Apache是一个软件基金会,ASF (Apache Software Foundation)(apache软件基金会),维护了近百个项目
httpd ,tomcat ,cloudware(ias的云计算平台) , hadoop 每一个都很著名,,,,,Apache其实不是web服务器,是个代称,是软件基金会的名称,提供web服务器的名称就叫 httpd
httpd: 最新版本2.4.4 http://httpd.apache.org/ 源码安装
php: 最新版本5.4.13 https://www.php.net/ 源码安装
MySQL: 最新版本5.6.10 跟5.5有很大不同,目前广泛使用的是5.5,这里先讲5.5的使用 (Mysql服务器更新一般不快,数据在里面,一更新,不兼容,会致命的) (rpm安装,通用二进制格式, 源码安装) (除非特别需要,对方编译好的二进制基本可用的,将来一般是通用二进制格式)(源码安装以后会讲) 二进制安装
先确保没有安装rpm包版本的LAMP平台,确保是一个干净的平台
安装顺序 httpd-->MySQL(php要想连接到mysql,必须要在编译php的时候,告诉它mysql在哪里,使用哪个mysql,编译php的时候,依赖于mysql的头文件和库文件)-->PHP-->Xcache
httpd , 有众多版本,能够运行在众多不同的平台上,但是httpd是用C语言开发的,不可能在任何平台上都运行,没办法快速移植,没办法快速兼容,意味着要开发多个httpd的版本,对httpd来讲,不爽,而且对于httpd项目的开发人员来讲,很不爽,他们要开发很多种不同的版本,他们采取了一种折中的办法,
httpd本身程序是一模一样的,但是它把各种底层硬件操作系统的不同,通过一个虚拟机给磨合(抹合)起来,这个虚拟机叫apr
: ( Apache Portable Runtime envirment ) apache可移植运行环境
意味着apr有多种版本,windows版本的apr,也可以运行httpd;;linux版本的apr,也可以运行httpd
所以 httpd是没有变化的,只是底层的apr才有变化
[root@localhost ~]# rpm -q apr #它是一个库
apr-1.2.7-11.el5_6.5
[root@localhost ~]#
[root@localhost ~]# rpm -q apr-util (util (utility)工具 组件) #apr-util是apr库所提供的各种命令行工具
apr-util-1.2.7-11.el5_5.2
[root@localhost ~]#
[root@localhost ~]# rpm -qi apr-util
Name : apr-util Relocations: (not relocatable)
Version : 1.2.7 Vendor: Red Hat, Inc.
Release : 11.el5_5.2 Build Date: 2010年12月02日 星期四 19时57分18秒
Install Date: 2018年11月10日 星期六 14时08分27秒 Build Host: x86-003.build.bos.redhat.com
Group : System Environment/Libraries Source RPM: apr-util-1.2.7-11.el5_5.2.src.rpm
Size : 167764 License: Apache Software License 2.0
Signature : DSA/SHA1, 2010年12月06日 星期一 22时02分14秒, Key ID 5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://apr.apache.org/
Summary : Apache 可移植运行时间库。
Description :
Apache Portable Runtime (APR) 提供了一个 C 语言数据结构和函数库。这个库包括 APR 的额外应用程序接口,如 XML, LDAP 的支持,数据库接口,URI 解析等。
[root@localhost ~]#
apache (httpd) 依赖于 apr apr-util
http://www.apache.org http://www.apache.org/index.html#projects-list
APR
APR-util
APR-iconv 这个其实用到的场景比较少 可以不用装
只要提供 APR,APR-util 就能安装 httpd了
httpd 2.4.4 将依赖于更新版本的 apr ,将依赖于1.4版本以上的apr
而我们原来安装的是 apr ,apr-util 都是1.2的版本
所以我们要安装新版本的APR,APR-util以后,才能安装httpd的
老版本的 ( APR,APR-util ) ,即使没有安装 httpd ,也已经装上去了
卸载老版本的 APR,APR-util ,可能会被别人依赖的,所以不能卸载老版本的 APR,APR-util
如果升级 老版本的 APR,APR-util ,那么老版本的 APR,APR-util 也没了,所以也不能升级
对于 APR,APR-util (对于 httpd 也一样 )只能使用多版本并存机制
把新版本与老版本安装的 不在同一个地方就成了
安装 rpm包时,
二进制程序通常在 /bin /sbin /usr/bin /usr/sbin ,官方所提供的rpm包,通常都在这几个路径下
库文件通常在 /lib /usr/lib ,官方所提供的rpm包,通常都在这几个路径下
配置文件通常在 /etc 官方所提供的rpm包,通常都在这几个路径下
帮助文档文件通常在 /etc/share/{doc, man} (doc下是文档,man下是手册) 官方所提供的rpm包,通常都在这几个路径下
编译安装: 安装在不同的路径下就不会冲突了,就不会覆盖掉原有的
/usr/local 这是我们自己定义安装的第三方软件的地方
bin sbin 二进制程序
lib 库文件
etc 配置文件
share/{doc,man} 帮助文档文件
想卸载怎么办? (rpm安装的 用 rpm -e 卸载,它会自动把每一个文件都删除的)
自己自定义安装的话,只能一个一个的找,一个一个的删掉
比如 apr 装在 /usr/local/apr 下
bin sbin lib includes etc share/man 等等
想卸载,(反正没有注册表), 直接删除 /usr/local/apr 目录就可以
/usr/local/apr/bin 路径不在path环境变量中,所以不能直接执行命令 所以修改path变量
/usr/local/apr/lib 库文件也找不到,所以要修改库文件搜索路径
/usr/local/apr/includes 头文件也找不到,所以链接过去
/usr/local/apr/share/man man文件找不到,所以修改man的配置文件(或者 man -m 选项)
先安装 apr , apr-util 然后再安装 httpd
MPM: prefork,worker,event
模块化方式使用MPM
# yum -y install pcre-devel
# tar xf apr-1.4.6.tar.bz2
# cd apr-1.4.6
# ./configure --prefix=/usr/local/apr
# make
# make install
# tar xf apr-util-1.4.1.tar.bz2
# cd apr-util-1.4.1
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make install
# tar xf httpd-2.4.4.tar.bz2
# cd httpd-2.4.4
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewrite --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
# make
# make install
安装之前 请确保开发环境都己经安装好了
[root@localhost ~]# yum grouplist
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, filter-data,
: keys, kmod, list-data, priorities, protect-packages,
: protectbase, security, tmprepo, verify, versionlock
Setting up Group Process
Loading mirror speeds from cached hostfile
Cdrom_Base | 1.5 kB 00:00
Installed Groups:
GNOME 桌面环境
GNOME 软件开发
MySQL 数据库
X 窗口系统
X 软件开发
万维网服务器
办公/生产率
图形
图形化互联网
基于文本的互联网
开发工具
开发库
打印支持
授权和出版
服务器配置工具
游戏和娱乐
管理工具
系统工具
编辑器
网络服务器
老的网络服务器
老的软件开发
老的软件支持
视频和音频
邮件服务器
Available Groups:
DNS 名称服务器
FTP 服务器
Java开发
KDE 软件开发
KDE (K 桌面环境)
OpenFabrics 企业版发行
PostgreSQL 数据库
Windows 文件服务器
工程和科学
新闻服务器
Done
[root@localhost ~]#
马哥的
[root@localhost ~]# export LANG=C
[root@localhost ~]# yum grouplist
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, filter-data,
: keys, kmod, list-data, priorities, protect-packages,
: protectbase, security, tmprepo, verify, versionlock
Setting up Group Process
Loading mirror speeds from cached hostfile
Installed Groups:
Administration Tools
Authoring and Publishing
Development Libraries #确保它装上
Development Tools #确保它装上
Editors
GNOME Desktop Environment
GNOME Software Development
Games and Entertainment
Graphical Internet
Graphics
Legacy Network Server
Legacy Software Development
Legacy Software Support
Mail Server
MySQL Database
Network Servers
Office/Productivity
Printing Support
Server Configuration Tools
Sound and Video
System Tools
Text-based Internet
Web Server
X Software Development
X Window System
Available Groups:
DNS Name Server
Engineering and Scientific
FTP Server
Java Development
KDE (K Desktop Environment)
KDE Software Development
News Server
OpenFabrics Enterprise Distribution
PostgreSQL Database
Windows File Server
Done
[root@localhost ~]#
马哥的
马哥的 Development Tools 已装过 ,Development Libraries 未装过(未看到)
其实 Development Libraries 很可能已经装过了,但是它并没有显示安装,因为 装 Development Tools 的时候,是依赖于 Development Libraries 的 (但马哥这里没装)
马哥做的apr ,apr-util 的 rpm包,是升级原来的apr,apr-util的(取代原来的旧版本,因为旧版本可能会被依赖),最好不要用
https://apr.apache.org/download.cgi
https://archive.apache.org/dist/apr/
[root@localhost ~]# wget https://archive.apache.org/dist/apr/apr-1.4.6.tar.bz2
--2019-04-02 16:27:18-- https://archive.apache.org/dist/apr/apr-1.4.6.tar.bz2
Resolving archive.apache.org... 163.172.17.199
Connecting to archive.apache.org|163.172.17.199|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 785724 (767K) [application/x-bzip2]
Saving to: `apr-1.4.6.tar.bz2'
100%[======================================>] 785,724 190K/s in 4.0s
2019-04-02 16:27:23 (190 KB/s) - `apr-1.4.6.tar.bz2' saved [785724/785724]
[root@localhost ~]# wget https://archive.apache.org/dist/apr/apr-util-1.4.1.tar.bz2
--2019-04-02 16:28:03-- https://archive.apache.org/dist/apr/apr-util-1.4.1.tar.bz2
Resolving archive.apache.org... 163.172.17.199
Connecting to archive.apache.org|163.172.17.199|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 635000 (620K) [application/x-bzip2]
Saving to: `apr-util-1.4.1.tar.bz2'
100%[======================================>] 635,000 105K/s in 5.9s
2019-04-02 16:28:11 (105 KB/s) - `apr-util-1.4.1.tar.bz2' saved [635000/6350
http://httpd.apache.org/download.cgi
http://archive.apache.org/dist/httpd/
[root@localhost ~]#
[root@localhost ~]# wget http://archive.apache.org/dist/httpd/httpd-2.4.4.tar.bz2
--2019-04-02 16:32:18-- http://archive.apache.org/dist/httpd/httpd-2.4.4.tar.bz2
Resolving archive.apache.org... 163.172.17.199
Connecting to archive.apache.org|163.172.17.199|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4780289 (4.6M) [application/x-bzip2]
Saving to: `httpd-2.4.4.tar.bz2'
100%[==================================>] 4,780,289 188K/s in 27s
2019-04-02 16:32:46 (170 KB/s) - `httpd-2.4.4.tar.bz2' saved [4780289/4780289]
[root@localhost ~]#
我们一般专门放源码包的地方
[root@localhost sysconfig]# ls /usr/local/src
[root@localhost sysconfig]#
这里我们就在家目录里面编译安装吧
[root@localhost ~]# pwd
/root
[root@localhost ~]# ls
Desktop fstab server.crt
anaconda-ks.cfg httpd-2.4.4.tar.bz2 server.key
apr-1.4.6.tar.bz2 id_rsa_2048.pub server1024.key
apr-1.4.6.tar.gz inittab server2048.key
apr-util-1.4.1.tar.bz2 inittab.des sysroot.gz
bincopy.sh inittab.des3 test
bind-9.7.4 install.log test-bak
bind-9.7.4.tar.gz install.log.syslog tiny.1.gz
boot.iso ks.cfg tiny.2.gz
busybox-1.20.2 ks.cfg-bak tiny.3.gz
busybox-1.20.2.tar.bz2 linux-2.6.38.5.tar.gz tiny.4.gz
cofig-2.6.28.5-i686.cfg mbr.backup tiny.5.gz
dropbear-2013.56 mkdir tiny.8.gz
dropbear-2013.56.tar.bz2 named.conf
[root@localhost ~]#
先装 apr ,再装apr-util(因为它依赖于apr) 再装 httpd
[root@localhost ~]# date (要保证电脑的日期在源码包的后面,否则的话,总不可能未来的源码包安装在现在的电脑上吧,因为电脑系统会错乱的,系统理解不了的)
Tue Apr 2 16:35:06 CST 2019
[root@localhost ~]#
马哥 把硬件时间同步为系统时间 # hwclock -s
[root@localhost ~]# tar xf apr-1.4.6.tar.bz2
[root@localhost ~]#
[root@localhost ~]# cd apr-1.4.6
[root@localhost apr-1.4.6]#
[root@localhost apr-1.4.6]# ls
CHANGES apr.dsw configure libapr.mak shmem
LICENSE apr.mak configure.in libapr.rc strings
Makefile.in apr.pc.in docs locks support
Makefile.win apr.spec dso memory tables
NOTICE atomic emacs-mode misc test
NWGNUmakefile build file_io mmap threadproc
README build-outputs.mk helpers network_io time
apr-config.in build.conf include passwd user
apr.dep buildconf libapr.dep poll
apr.dsp config.layout libapr.dsp random
[root@localhost apr-1.4.6]#
编译安装三步骤 configure, make, make install
[root@localhost apr-1.4.6]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-layout=LAYOUT
--enable-experimental-libtool Use experimental custom libtool
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-debug Turn on debugging and compile time warnings
--enable-maintainer-mode Turn on debugging and compile time warnings
--enable-profile Turn on profiling for the build (GCC)
--enable-pool-debug[=yes|no|verbose|verbose-alloc|lifetime|owner|all] Turn on pools debugging
--enable-malloc-debug Switch on malloc_debug for BeOS
--disable-lfs Disable large file support on 32-bit platforms
--enable-nonportable-atomics Use optimized atomic code which may produce nonportable binaries
--enable-threads Enable threading support in APR. # 启用线程
--enable-allocator-uses-mmap Use mmap in apr_allocator instead of malloc (experimental)
--disable-dso Disable DSO support
--enable-other-child Enable reliable child processes
--disable-ipv6 Disable IPv6 support in APR. # 禁用ipv6
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot=DIR Search for dependent libraries within DIR
(or the compiler's sysroot if not specified).
--with-installbuilddir=DIR location to store APR build files (defaults to '${datadir}/build')
--without-libtool avoid using libtool to link the library
--with-efence[=DIR] path to Electric Fence installation
--with-sendfile Override decision to use sendfile
--with-egd[=DIR] use EGD-compatible socket
--with-devrandom[=DEV] use /dev/random or compatible [searches by default]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
[root@localhost apr-1.4.6]#
[root@localhost apr-1.4.6]# ./configure --prefix=/usr/local/apr #--prefix指定默认安装路径
(现在用的是红帽5.10的版本 ,如果用的是红帽6的版本的话,apr好像已经更新到1.4了,所以就不需要安装了)
......................
[root@localhost apr-1.4.6]# make
......................
[root@localhost apr-1.4.6]# make install
......................
这个apr1.4 对我们新装的 apache有用之外,对于我们整个系统是没有用的,在安装 httpd2.4的时候,告诉httpd2.4,apr1.4在什么地方就可以了
所以这里 apr1.4 不需要输出它的bin路径,库文件,头文件,apache2.4自己会去找的
所以到此为止,不需要额外配置,apr1.4就安装好了.
安装 apr-util
[root@localhost apr-1.4.6]# cd
[root@localhost ~]# tar xf apr-util-1.4.1.tar.bz2
[root@localhost ~]#
[root@localhost ~]# cd apr-util-1.4.1
[root@localhost apr-util-1.4.1]#
[root@localhost apr-util-1.4.1]# ./configure --help | less
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-layout=LAYOUT
--disable-util-dso disable DSO build of modular components (crypto,
dbd, dbm, ldap)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-apr=PATH prefix for installed APR or the full path to # 告诉它 apr装的路径
apr-config
--with-apr-iconv=DIR relative path to apr-iconv source
--with-crypto enable crypto support
--with-openssl=DIR specify location of OpenSSL
--with-nss=DIR specify location of NSS
--with-lber=library lber library to use
--with-ldap-include=path path to ldap include files with trailing slash
--with-ldap-lib=path path to ldap lib file
--with-ldap=library ldap library to use
--with-dbm=DBM choose the DBM type to use.
DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db41,db42,db43,db44,db45,db46,db47,db48,db50,db51}
--with-gdbm=DIR enable GDBM support
--with-ndbm=PATH Find the NDBM header and library in `PATH/include'
and `PATH/lib'. If PATH is of the form `HEADER:LIB',
then search for header files in HEADER, and the
library in LIB. If you omit the `=PATH' part
completely, the configure script will search for
NDBM in a number of standard places.
--with-berkeley-db=PATH Find the Berkeley DB header and library in
`PATH/include' and `PATH/lib'. If PATH is of the
form `HEADER:LIB', then search for header files in
HEADER, and the library in LIB. If you omit the
`=PATH' part completely, the configure script will
search for Berkeley DB in a number of standard
places.
--with-pgsql=DIR specify PostgreSQL location
--with-mysql=DIR enable MySQL DBD driver # 告诉它 mysql安装在哪里 但是马哥说 现在没有意义
--with-sqlite3=DIR enable sqlite3 DBD driver
--with-sqlite2=DIR enable sqlite2 DBD driver
--with-oracle-include=DIR
path to Oracle include files
--with-oracle=DIR enable Oracle DBD driver; giving ORACLE_HOME as DIR
--with-freetds=DIR specify FreeTDS location
--with-odbc=DIR specify ODBC location
--with-expat=DIR specify Expat location, or 'builtin'
--with-iconv=DIR path to iconv installation
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
[root@localhost apr-util-1.4.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# --prefix=/usr/local/apr-util 指定安装在何处, --with-apr 告诉它apr在哪里,如果忘了加的话,(告诉它额外的程序,到哪里去找额外的它所依赖的程序,这里一定要是 apr1.4的(新版本的程序)) 它就会找原来默认的apr1.2的程序(旧版本的apr)
.........................
[root@localhost apr-util-1.4.1]# make
.........................
[root@localhost apr-util-1.4.1]# make install
.........................
安装 httpd
[root@localhost apr-util-1.4.1]# cd
[root@localhost ~]# tar xf httpd-2.4.4.tar.bz2
[root@localhost ~]#
[root@localhost ~]# cd httpd-2.4.4
[root@localhost httpd-2.4.4]#
[root@localhost httpd-2.4.4]# ./configure --help | less
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/apache2] # 程序安装路径
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/apache2/bin', `/usr/local/apache2/lib' etc. You can specify
an installation prefix other than `/usr/local/apache2' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] #一般到 /etc/httpd下找配置文件
最好放到 /etc/httpd下面吧 ,sysconfdir 就是指定配置文件的安装路径的,最好改一改,不改的话就在默认安装路径下面的 etc目录下面去找,对于apache目录来讲,是默认安装路径下的conf目录
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
Optional Features: # 可选的特性
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-layout=LAYOUT
--enable-dtrace Enable DTrace probes
--enable-hook-probes Enable APR hook probes
--enable-exception-hook Enable fatal exception hook
--enable-load-all-modules
Load all modules
--enable-maintainer-mode
Turn on debugging and compile time warnings and load
all compiled modules
--enable-debugger-mode Turn on debugging and compile time warnings and turn
off optimization
--enable-pie Build httpd as a Position Independent Executable
--enable-modules=MODULE-LIST #启用模块
Space-separated list of modules to enable | "all" |
"most" | "few" | "none" | "reallyall"
--enable-mods-shared=MODULE-LIST #是不是启用共享模块
Space-separated list of shared modules to enable |
"all" | "most" | "few" | "reallyall"
#all所有 most大多数 few仅有的最少的几个 reallyall 真实的所有?暂时不用管与all的区别
--enable-mods-static=MODULE-LIST #静态方式的模块,直接编译进去的
Space-separated list of static modules to enable |
"all" | "most" | "few" | "reallyall"
--disable-authn-file file-based authentication control #默认基于文件的认证 使用它的话就是禁用基于文件的认证
--enable-authn-dbm DBM-based authentication control #基于dbm认证,不讲了
--enable-authn-anon anonymous user authentication control #基于anon认证不讲了
--enable-authn-dbd SQL-based authentication control #基于dbd 认证,不讲了
--enable-authn-socache Cached authentication control #基于socache 认证,不讲了
--disable-authn-core core authentication module #基于core 认证,不讲了
--disable-authz-host host-based authorization control #基于host 认证,不讲了
--disable-authz-groupfile #基于groupfile 认证,不讲了
'require group' authorization control
--disable-authz-user 'require user' authorization control #基于user 认证,不讲了
--enable-authz-dbm DBM-based authorization control #基于dbm 认证,不讲了
--enable-authz-owner 'require file-owner' authorization control #基于owner 认证,不讲了
--enable-authz-dbd SQL based authorization and Login/Session support #基于dbd 认证,不讲了
--disable-authz-core core authorization provider vector module #基于core 认证,不讲了
--enable-authnz-ldap LDAP based authentication
--disable-access-compat mod_access compatibility
--disable-auth-basic basic authentication #基于basic 认证,不讲了
--enable-auth-form form authentication #基于form 认证,不讲了
--enable-auth-digest RFC2617 Digest authentication #基于 digest 认证,不讲了
--enable-allowmethods restrict allowed HTTP methods
--enable-isapi isapi extension support
--enable-file-cache File cache
--enable-cache dynamic file caching. At least one storage
management module (e.g. mod_cache_disk) is also
necessary.
--enable-cache-disk disk caching module
--enable-socache-shmcb shmcb small object cache provider
--enable-socache-dbm dbm small object cache provider
--enable-socache-memcache
memcache small object cache provider
--enable-socache-dc distcache small object cache provider
--enable-so ( so: share object ) DSO capability. This module will be automatically #这个是默认的,表示支持动态共享模块 如果不支持这个功能,php将无法以模块方式跟apache结合起来工作 所以这一项必须得有的
enabled unless you build all modules statically.
--enable-watchdog Watchdog module
--enable-dbd Apache DBD Framework
--enable-bucketeer buckets manipulation filter. Useful only for
developers and testing purposes.
--enable-dumpio I/O dump filter
--enable-echo ECHO server
--enable-example-hooks Example hook callback handler module
--enable-case-filter Example uppercase conversion filter
--enable-case-filter-in Example uppercase conversion input filter
--enable-example-ipc Example of shared memory and mutex usage
--enable-buffer Filter Buffering
--enable-data RFC2397 data encoder
--enable-ratelimit Output Bandwidth Limiting
--disable-reqtimeout Limit time waiting for request from client
--enable-ext-filter external filter module
--enable-request Request Body Filtering
--enable-include Server Side Includes
--disable-filter Smart Filtering
--enable-reflector Reflect request through the output filter stack
--enable-substitute response content rewrite-like filtering
--enable-sed filter request and/or response bodies through sed
--disable-charset-lite character set translation. Enabled by default only
on EBCDIC systems.
--enable-charset-lite character set translation. Enabled by default only
on EBCDIC systems.
--enable-deflate Deflate transfer encoding support # deflate是一种压缩机制,gzip压缩?它能够让httpd服务器自动的压缩一下传送给浏览器,浏览器可以解压缩 再查看 ,它可以节约带宽,这是一种常用的压缩机制
--enable-xml2enc i18n support for markup filters
--enable-proxy-html Fix HTML Links in a Reverse Proxy
--enable-http HTTP protocol handling. The http module is a basic
one that enables the server to function as an HTTP
server. It is only useful to disable it if you want
to use another protocol module instead. Don't
disable this module unless you are really sure what
you are doing. Note: This module will always be
linked statically.
--disable-mime mapping of file-extension to MIME. Disabling this
module is normally not recommended.
--enable-ldap LDAP caching and connection pooling services
--disable-log-config logging configuration. You won't be able to log
requests to the server without this module.
--enable-log-debug configurable debug logging
--enable-log-forensic forensic logging
--enable-logio input and output logging
--enable-lua Apache Lua Framework
--enable-luajit Enable LuaJit Support
--disable-env clearing/setting of ENV vars
--enable-mime-magic automagically determining MIME type
--enable-cern-meta CERN-type meta files
--enable-expires Expires header control #过期首部控制
--disable-headers HTTP header control
--enable-ident RFC 1413 identity check
--enable-usertrack user-session tracking
--enable-unique-id per-request unique ids
--disable-setenvif basing ENV vars on headers
--disable-version determining httpd version in config files
--enable-remoteip translate header contents to an apparent client
remote_ip
--enable-proxy Apache proxy module
--enable-proxy-connect Apache proxy CONNECT module. Requires and is enabled
by --enable-proxy.
--enable-proxy-ftp Apache proxy FTP module. Requires and is enabled by
--enable-proxy.
--enable-proxy-http Apache proxy HTTP module. Requires and is enabled by
--enable-proxy.
--enable-proxy-fcgi Apache proxy FastCGI module. Requires and is enabled # 假如将来打算 php 与 apache 是以 fastcgi 方式工作的 这个要启用起来 (现在准备以模块的方式工作,所以可以不用它)
by --enable-proxy.
--enable-proxy-scgi Apache proxy SCGI module. Requires and is enabled by
--enable-proxy.
--enable-proxy-fdpass Apache proxy to Unix Daemon Socket module. Requires
--enable-proxy.
--enable-proxy-ajp Apache proxy AJP module. Requires and is enabled by
--enable-proxy.
--enable-proxy-balancer Apache proxy BALANCER module. Requires and is
enabled by --enable-proxy.
--enable-proxy-express mass reverse-proxy module. Requires --enable-proxy.
--enable-session session module
--enable-session-cookie session cookie module
--enable-session-crypto session crypto module
--enable-session-dbd session dbd module
--enable-slotmem-shm slotmem provider that uses shared memory
--enable-slotmem-plain slotmem provider that uses plain memory
--enable-ssl SSL/TLS support (mod_ssl) #启用ssl的功能,不启用它的话,没法使用https
--enable-ssl-staticlib-deps
link mod_ssl with dependencies of OpenSSL's static
libraries (as indicated by "pkg-config --static").
Must be specified in addition to --enable-ssl.
--enable-optional-hook-export
example optional hook exporter
--enable-optional-hook-import
example optional hook importer
--enable-optional-fn-import
example optional function importer
--enable-optional-fn-export
example optional function exporter
--enable-dialup rate limits static files to dialup modem speeds
--enable-static-support Build a statically linked version of the support
binaries
--enable-static-htpasswd
Build a statically linked version of htpasswd
--enable-static-htdigest
Build a statically linked version of htdigest
--enable-static-rotatelogs
Build a statically linked version of rotatelogs
--enable-static-logresolve
Build a statically linked version of logresolve
--enable-static-htdbm Build a statically linked version of htdbm
--enable-static-ab Build a statically linked version of ab
--enable-static-checkgid
Build a statically linked version of checkgid
--enable-static-htcacheclean
Build a statically linked version of htcacheclean
--enable-static-httxt2dbm
Build a statically linked version of httxt2dbm
--enable-static-fcgistarter
Build a statically linked version of fcgistarter
--enable-lbmethod-byrequests
Apache proxy Load balancing by request counting
--enable-lbmethod-bytraffic
Apache proxy Load balancing by traffic counting
--enable-lbmethod-bybusyness
Apache proxy Load balancing by busyness
--enable-lbmethod-heartbeat
Apache proxy Load balancing from Heartbeats
--enable-mpms-shared=MPM-LIST # 打算启用哪些MPM,而且以共享方式来启用的 "all" 就是多个都启用起来, 或者启用两个 worker和event 或者启用两个 prework和event 或者启用 prework和worker
2.2中没有 2.4中才有 apache支持MPM(多道处理模块) (prefork,worker,event)到底支持哪一种在编译的时候就已经确定了, 2.4中有个特性,就是可以以模块化的方式使用MPM,意味着你可以把这三个模块同时编译进来,你想用哪个,就切换哪个;;;;但是有个缺陷,php以模块化的方式跟apache结合的时候,如果使用prefork,php很简单,但是使用worker或event,我们的php必须要编译成zts格式(线程安全?) 如果要灵活使用不同格式的话,要编译两次php? (prefork 和 work或event 使用的php格式不一样)不理解? 默认编译安装的时候,默认应该使用event(只要机器支持) 因为它假设event性能是最好的 (2.4编译安装时,默认的MPM是event了)(2.2 rpm安装时,默认的是prework)
Space-separated list of MPM modules to enable for
dynamic loading. MPM-LIST=list | "all"
--enable-unixd unix specific support
--enable-privileges Per-virtualhost Unix UserIDs and enhanced security
for Solaris
--enable-heartbeat Generates Heartbeats
--enable-heartmonitor Collects Heartbeats
--enable-dav WebDAV protocol handling. --enable-dav also enables
mod_dav_fs
--disable-status process/thread monitoring
--disable-autoindex directory listing
--enable-asis as-is filetypes
--enable-info server information
--enable-suexec set uid and gid for spawned processes
--enable-cgid CGI scripts. Enabled by default with threaded MPMs #被线程 方式的MPM来使用,所以要使用的是event或者worker的MPM的话,得启用 cgid
--enable-cgi CGI scripts. Enabled by default with non-threaded # 支持cgi
MPMs
--enable-dav-fs DAV provider for the filesystem. --enable-dav also
enables mod_dav_fs.
--enable-dav-lock DAV provider for generic locking
--enable-vhost-alias mass virtual hosting module
--enable-negotiation content negotiation
--disable-dir directory request handling
--enable-imagemap server-side imagemaps
--enable-actions Action triggering on requests
--enable-speling correct common URL misspellings
--enable-userdir mapping of requests to user-specific directories
--disable-alias mapping of requests to different filesystem parts
--enable-rewrite rule based URL manipulation # 支持 url 重写的
--enable-v4-mapped Allow IPv6 sockets to handle IPv4 connections
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-included-apr Use bundled copies of APR/APR-Util
--with-apr=PATH prefix for installed APR or the full path to
apr-config
--with-apr-util=PATH prefix for installed APU or the full path to
apu-config
--with-pcre=PATH Use external PCRE library
--with-port=PORT Port on which to listen (default is 80)
--with-sslport=SSLPORT Port on which to securelisten (default is 443)
--with-distcache=PATH Distcache installation directory
--with-z=PATH use a specific zlib library
--with-libxml2=PATH location for libxml2
--with-lua=PATH Path to the Lua 5.1 prefix
--with-ssl=PATH OpenSSL installation directory
--with-mpm=MPM Choose the process model for Apache to use by #明确说明我们使用哪一个为默认可以定义4个 {event|worker|prefork|winnt} 如果不指系统会自己找一个为默认,2.4默认一般为event
default. MPM={event|worker|prefork|winnt} This will
be statically linked as the only available MPM
unless --enable-mpms-shared is also specified.
--with-module=module-type:module-file
Enable module-file in the modules/<module-type>
directory.
--with-program-name alternate executable name
--with-suexec-bin Path to suexec binary
--with-suexec-caller User allowed to call SuExec
--with-suexec-userdir User subdirectory
--with-suexec-docroot SuExec root directory
--with-suexec-uidmin Minimal allowed UID
--with-suexec-gidmin Minimal allowed GID
--with-suexec-logfile Set the logfile
--with-suexec-safepath Set the safepath
--with-suexec-umask umask for suexec'd process
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
[root@localhost httpd-2.4.4]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewrite --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... -std=gnu99
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
[root@localhost httpd-2.4.4]#
没装 pcre
[root@localhost httpd-2.4.4]# yum -y install pcre-devel
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, filter-data,
: keys, kmod, list-data, priorities, protect-packages,
: protectbase, security, tmprepo, verify, versionlock
Loading mirror speeds from cached hostfile
Cdrom_Base | 1.5 kB 00:00
Skipping filters plugin, no data
0 packages excluded due to repository protections
Reading version lock configuration
Setting up Install Process
Resolving Dependencies
Skipping filters plugin, no data
--> Running transaction check
---> Package pcre-devel.i386 0:6.6-9.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
pcre-devel i386 6.6-9.el5 Cdrom_Base 181 k
Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 181 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : pcre-devel 1/1
Installed:
pcre-devel.i386 0:6.6-9.el5
Complete!
[root@localhost httpd-2.4.4]#
[root@localhost httpd-2.4.4]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewrite --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
......................................
[root@localhost httpd-2.4.4]# make
..................................
[root@localhost httpd-2.4.4]# make install
..................................
web服务器受selinux控制的,如果此前启用了selinux,可能httpd启动不了(或者启动起来,运行不了),所以建议selinux是关闭的
马哥学校里自动化安装,selinux默认是开着的
[root@localhost httpd-2.4.4]# getenforce # 我这里是已经关掉了
Disabled
[root@localhost httpd-2.4.4]#
# setenforce 0 临时关闭
[root@localhost httpd-2.4.4]# vim /etc/selinux/config 永久关闭
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled # 改成 permissive 或 disabled 都可以永久关闭
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
~
下面如何启动 httpd 2.4.4呢?
[root@localhost httpd-2.4.4]# cd /usr/local/apache/
[root@localhost apache]# ls
bin build cgi-bin error htdocs icons include logs man manual modules
[root@localhost apache]#
[root@localhost apache]# ls /etc/init.d/
acpid gpm microcode_ctl rpcidmapd
anacron haldaemon multipathd rpcsvcgssd
apmd halt mysqld saslauthd
atd hidd named sendmail
auditd hplip netconsole setroubleshoot
autofs httpd netfs single
avahi-daemon ip6tables netplugd smartd
avahi-dnsconfd ipmi network squid
bluetooth iptables NetworkManager sshd
capi irda nfs svnserve
conman irqbalance nfslock syslog
cpuspeed iscsi nscd tux
crond iscsid ntpd vncserver
cups isdn pand wdaemon
cups-config-daemon kdump pcscd winbind
dc_client killall portmap wpa_supplicant
dc_server krb524 psacct xfs
dhcpd kudzu rawdevices xinetd
dhcrelay lvm2-monitor rdisc ypbind
dnsmasq mcstrans readahead_early yum-updateonboot
dund mdmonitor readahead_later yum-updatesd
firstboot mdmpd restorecond
functions messagebus rpcgssd
[root@localhost apache]# ls /etc/init.d/ | grep httpd # 这个是原来的httpd
httpd
[root@localhost apache]#
[root@localhost apache]# pwd
/usr/local/apache
[root@localhost apache]#
[root@localhost apache]# bin
bin/ bind
[root@localhost apache]# bin
bin/ bind
[root@localhost apache]# bin/
ab checkgid htcacheclean htpasswd logresolve
apachectl dbmmanage htdbm httpd rotatelogs
apxs fcgistarter htdigest httxt2dbm
[root@localhost apache]# bin/ap
apachectl apxs
[root@localhost apache]# file bin/apachectl # 这是一个脚本
bin/apachectl: Bourne shell script text executable
[root@localhost apache]#
[root@localhost apache]# vim bin/apachectl
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache. Written by Marc Slemko, 1997/08/23
#
# The exit codes returned are:
# XXX this doc is no longer correct now that the interesting
# XXX functions are handled by httpd
# 0 - operation completed successfully
# 1 -
# 2 - usage error
# 3 - httpd could not be started
# 4 - httpd could not be stopped
# 5 - httpd could not be started during a restart
# 6 - httpd could not be restarted during a restart
# 7 - httpd could not be restarted during a graceful restart
# 8 - configuration syntax error
#
#
# When multiple arguments are given, only the error from the _last_
# one is reported. Run "apachectl help" for usage info
#
ACMD="$1"
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
# -------------------- --------------------
#
# the path to your httpd binary, including options if necessary
HTTPD='/usr/local/apache/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/apache/bin/envvars; then
. /usr/local/apache/bin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line. Designed for lynx, however other
# programs may work.
LYNX="links -dump"
#
#
# the URL to your server's mod_status status page. If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# -------------------- --------------------
# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
$ULIMIT_MAX_FILES
fi
ERROR=0
if [ "x$ARGV" = "x" ] ; then
ARGV="-h"
fi
case $ACMD in
start|stop|restart|graceful|graceful-stop) # 这是有启动 停止 重启等作为参数
$HTTPD -k $ARGV
ERROR=$?
;;
startssl|sslstart|start-SSL)
echo The startssl option is no longer supported.
echo Please edit httpd.conf to include the SSL configuration settings
echo and then use "apachectl start".
ERROR=2
;;
configtest)
$HTTPD -t
ERROR=$?
;;
status)
$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
;;
fullstatus)
$LYNX $STATUSURL
;;
*)
$HTTPD "$@"
ERROR=$?
esac
exit $ERROR
把 bin/apachectl 改造一下 , 加上 chkconfing , description ,就可以放到 /etc/init.d 目录下 就可以作为服务启动了
[root@localhost apache]# bin/apachectl start
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
[root@localhost apache]#
[root@localhost apache]# service httpd stop # 关闭原来的 httpd
停止 httpd: [确定]
[root@localhost apache]#
[root@localhost apache]# bin/apachectl start
# bin/apachectl start有时不能启动,, 取消掉httpd.conf里面的 #LoadModule的注释就可以启动了,不理解
有问题见 /node-admin/16197 ,它这里有解决问题的办法
[root@localhost apache]#
[root@localhost apache]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 3821/./hpiod
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 6665/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3426/portmap
tcp 0 0 0.0.0.0:690 0.0.0.0:* LISTEN 3476/rpc.statd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3844/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3858/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3899/sendmail
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 3826/python
tcp 0 0 :::80 :::* LISTEN 3953/httpd
tcp 0 0 :::22 :::* LISTEN 3844/sshd
[root@localhost apache]#
[root@localhost apache]# pwd
/usr/local/apache
[root@localhost apache]#
[root@localhost apache]# ls # 安装以后的目录
bin build cgi-bin error htdocs icons include logs man manual modules
# build 是一个bin时的一个目录,不用管
# cgi-bin 执行cgi的存放位置
# error 错误信息,不是错误日志
# htdocs 网页文件的位置(自己手动编译安装时,网页文件的位置)
# icons 提供的一些图标 不用管
# include 头文件 有人用apache做二次开发的话,会用到这个目录,对我们而言,不重要
# logs 日志文件 不在/var/log下,但是可以通过 ./configure 进行修改
# man 帮助文件
# manual 手册
# modules 模块目录
[root@localhost apache]# ls bin #二进制程序都在这里 这个bin没有加入到PATH环境变量
ab checkgid envvars-std htdbm httpd rotatelogs
apachectl dbmmanage fcgistarter htdigest httxt2dbm
apxs envvars htcacheclean htpasswd logresolve
[root@localhost apache]#
[root@localhost apache]# ls htdocs/
index.html
[root@localhost apache]#
[root@localhost apache]# vim htdocs/index.html
<html><body><h1>It works! my apache</h1></body></html>
[root@localhost apache]# ls logs/ # httpd.pid 每个进程都有pid文件, 一般pid文件放在 /var/run 下面
access_log error_log httpd.pid
[root@localhost apache]#
[root@localhost apache]# ls /var/run/
acpid.socket cups klogd.pid pcscd.pid sm-client.pid
atd.pid cupsd.pid lvm pcscd.pub sshd.pid
audispd_events dbus mdadm pm sudo
auditd.pid gpm.pid mdmpd ppp syslogd.pid
autofs.fifo-misc haldaemon.pid messagebus.pid rhsm utmp
autofs.fifo-net hpiod.pid mysqld rpc.statd.pid winbindd
autofs.pid hpiod.port named saslauthd wpa_supplicant
avahi-daemon hpssd.pid netreport sdp xfs.pid
console hpssd.port NetworkManager sendmail.pid xinetd.pid
crond.pid iscsid.pid nscd setrans
cron.reboot iscsiuio.pid pcscd.comm setroubleshoot
[root@localhost apache]#
改下 httpd.pid 文件的位置
我们的 httpd.conf 改了 放在 /etc/httpd/httpd.conf (跟rpm包安装放的位置不一样,
rpm安装的话是放在 /etc/httpd/conf 目录下面 )
假如不改的话,是放在 /usr/local/apache/conf 目录里面
[root@localhost apache]# vim /etc/httpd/httpd.conf
......................................
serverRoot "/usr/local/apache"
#PidFile "/var/run/httpd.pid"
......................................
[root@localhost apache]# bin/apachectl stop
[root@localhost apache]#
[root@localhost apache]# netstat -tnlp # 80端口没了
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 3821/./hpiod
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 6665/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3426/portmap
tcp 0 0 0.0.0.0:690 0.0.0.0:* LISTEN 3476/rpc.statd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3844/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3858/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3899/sendmail
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 3826/python
tcp 0 0 :::22 :::* LISTEN 3844/sshd
[root@localhost apache]#
[root@localhost apache]# ls logs/ # 没有 httpd.pid 文件了 ,apache一关闭 httpd.pid就没有了
access_log error_log
[root@localhost apache]# vim /etc/httpd/httpd.conf
.............................
ServerRoot "/usr/local/apache"
PidFile "/var/run/httpd.pid" # 把刚刚的关于 httpd.pid 的注释删掉吧
......................................
[root@localhost apache]# bin/apachectl start
[root@localhost apache]#
[root@localhost apache]# netstat -tnlp # 80端口启用了
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 3821/./hpiod
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 6665/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3426/portmap
tcp 0 0 0.0.0.0:690 0.0.0.0:* LISTEN 3476/rpc.statd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3844/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3858/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3899/sendmail
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 3826/python
tcp 0 0 :::80 :::* LISTEN 4342/httpd
tcp 0 0 :::22 :::* LISTEN 3844/sshd
[root@localhost apache]#
[root@localhost apache]# ls logs/ #没有httpd.pid文件了
access_log error_log
[root@localhost apache]#
[root@localhost apache]# ls /var/run/ #这里有 httpd.pid 文件了
acpid.socket cups iscsiuio.pid pcscd.comm setroubleshoot
atd.pid cupsd.pid klogd.pid pcscd.pid sm-client.pid
audispd_events dbus lvm pcscd.pub sshd.pid
auditd.pid gpm.pid mdadm pm sudo
autofs.fifo-misc haldaemon.pid mdmpd ppp syslogd.pid
autofs.fifo-net hpiod.pid messagebus.pid rhsm utmp
autofs.pid hpiod.port mysqld rpc.statd.pid winbindd
avahi-daemon hpssd.pid named saslauthd wpa_supplicant
console hpssd.port netreport sdp xfs.pid
crond.pid httpd.pid NetworkManager sendmail.pid xinetd.pid
cron.reboot iscsid.pid nscd setrans
[root@localhost apache]#
自己可以自定义 httpd 的选项 PidFile 加到 httpd.conf 里面( 默认配置时没有启用而已 )
这是httpd 的 启动脚本 是马哥根据 rpm 安装后的 httpd的启动脚本改写的
上面的脚本要想正常执行,请确保,httpd.pid 要在 /var/run/ 下面去
马哥的操作
让它能够开机自动启动 把它加到服务列表中去
# chkconfig --add httpd
# chkconfig --list httpd
# chkconfig httpd on #这个未执行
此时 2,3,4,5级别都是 on 了 这个未执行
# chkconfig --level 35 httpd on
只让3,5级别on
# chkconfig --list httpd
此时 3,5 都是on了
下面这个文件的目的是 把 /usr/local/apache/bin 加到PATH路径中
[root@localhost apache]# vim /etc/profile.d/httpd.sh #必须要以 .sh结尾
export PATH=$PATH:/usr/local/apache/bin
# 默认情况下 /etc/profile.d/ 目录下的所有文件都是 profile的组成部分
放在这儿单独管理,不需要的时候把它删了 注意它不会立即生效
它是一个脚本,使用 bash 解释执行就 OK 了 ( 我为什么解释执行不行 我为什么非要用
# source /etc/profile.d/httpd.sh 或
# source /etc/profile
才行
)
或者重新登录一个 putty 就可以了
新的登录窗口, 此时可以看到 /usr/local/apache/bin
[root@localhost ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/apache/bin:/root/bin
[root@localhost ~]#
apachetcl,htpasswd, httpd 这些命令都可以用了
[root@localhost ~]# httpd -t #测试语法
Syntax OK
[root@localhost ~]#
[root@localhost ~]# httpd -l #列出模块
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
[root@localhost ~]#
马哥这边没 event,prefork模块, 说明它们被做成了共享模块,可以换了?没看懂
[root@localhost apache]# vim /etc/httpd/httpd.conf
......................................
LoadModule mpm_event_module modules/mod_mpm_event.so # 默认使用的是event模块 改成别的模块也可以( 比如 prefork )
LoadModule unixd_module modules/mod_unixd.so
#LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
......................................
[root@localhost ~]# httpd -M
Loaded Modules:
core_module (static)
mpm_prefork_module (static) # 我这边是静态的 prefork 模块 不是共享模块
http_module (static)
so_module (static)
auth_basic_module (shared)
auth_digest_module (shared)
authn_file_module (shared)
authn_alias_module (shared)
authn_anon_module (shared)
authn_dbm_module (shared)
authn_default_module (shared)
authz_host_module (shared)
authz_user_module (shared)
authz_owner_module (shared)
authz_groupfile_module (shared)
authz_dbm_module (shared)
authz_default_module (shared)
ldap_module (shared)
authnz_ldap_module (shared)
include_module (shared)
log_config_module (shared)
logio_module (shared)
env_module (shared)
ext_filter_module (shared)
mime_magic_module (shared)
expires_module (shared)
deflate_module (shared)
headers_module (shared)
usertrack_module (shared)
setenvif_module (shared)
mime_module (shared)
dav_module (shared)
status_module (shared)
autoindex_module (shared)
info_module (shared)
dav_fs_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
actions_module (shared)
speling_module (shared)
userdir_module (shared)
alias_module (shared)
rewrite_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_connect_module (shared)
cache_module (shared)
suexec_module (shared)
disk_cache_module (shared)
file_cache_module (shared)
mem_cache_module (shared)
cgi_module (shared)
version_module (shared)
perl_module (shared)
php5_module (shared)
proxy_ajp_module (shared)
python_module (shared)
ssl_module (shared)
Syntax OK
[root@localhost ~]#
马哥这边看到了 mpm_event_module (shared) 成了共享模块
[root@localhost apache]# vim /etc/httpd/httpd.conf
#LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
[root@localhost apache]# ls /usr/local/apache/modules/ 看看有没有 mpm_prefork_module 模块
httpd.exp mod_dbd.so mod_proxy_ftp.so
mod_access_compat.so mod_deflate.so mod_proxy_http.so
mod_actions.so mod_dir.so mod_proxy_scgi.so
mod_alias.so mod_dumpio.so mod_proxy.so
mod_allowmethods.so mod_env.so mod_ratelimit.so
mod_auth_basic.so mod_expires.so mod_remoteip.so
mod_auth_digest.so mod_ext_filter.so mod_reqtimeout.so
mod_auth_form.so mod_file_cache.so mod_request.so
mod_authn_anon.so mod_filter.so mod_rewrite.so
mod_authn_core.so mod_headers.so mod_sed.so
mod_authn_dbd.so mod_include.so mod_session_cookie.so
mod_authn_dbm.so mod_info.so mod_session_dbd.so
mod_authn_file.so mod_lbmethod_bybusyness.so mod_session.so
mod_authn_socache.so mod_lbmethod_byrequests.so mod_setenvif.so
mod_authz_core.so mod_lbmethod_bytraffic.so mod_slotmem_shm.so
mod_authz_dbd.so mod_lbmethod_heartbeat.so mod_socache_dbm.so
mod_authz_dbm.so mod_log_config.so mod_socache_memcache.so
mod_authz_groupfile.so mod_log_debug.so mod_socache_shmcb.so
mod_authz_host.so mod_logio.so mod_speling.so
mod_authz_owner.so mod_mime.so mod_ssl.so
mod_authz_user.so mod_mpm_event.so mod_status.so
mod_autoindex.so mod_mpm_prefork.so mod_substitute.so
mod_buffer.so mod_mpm_worker.so mod_unique_id.so
mod_cache_disk.so mod_negotiation.so mod_unixd.so
mod_cache.so mod_proxy_ajp.so mod_userdir.so
mod_cgid.so mod_proxy_balancer.so mod_version.so
mod_cgi.so mod_proxy_connect.so mod_vhost_alias.so
mod_dav_fs.so mod_proxy_express.so
mod_dav.so mod_proxy_fcgi.so
[root@localhost apache]#
[root@localhost apache]# httpd -t
Syntax OK
[root@localhost apache]#
[root@localhost apache]# service httpd restart
停止 httpd: [确定]
启动 httpd: [确定]
[root@localhost apache]#
马哥这边可以看到共享模块了
所以以后想修改什么模块,直接修改 httpd.conf 配置文件就OK了