LAMP搭建——apache安装
来源:互联网 发布:人工智能机械假肢感应 编辑:程序博客网 时间:2024/06/06 03:33
官网下载2.2版本。实际上我们所说的Apache真正的名字是httpd。
下载解压就不说了。
配置编译参数:
#cd http-2.2.24
#vim INSTALL
#./configure \
--prefix=/usr/local/apache2 \
--with-included-apr \
--enable-so \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--with-pcre
--prefix 指定安装到哪里,
--with-included-apr \
底层的一个模块,是数据可以跨平台使用。
--enable-so 表示启用DSO
DSO 是 Dynamic Shared Objects (动态共享目标)的缩写,它提供了一种在运行时将特殊格式的代码在程序运行需要时,将需要的部分从外存调
入内存执行的方法。 Apache 支持动态共享模块,也支持静态模块,静态的话,会把需要的目标直接编译进 apache 的可执行文件中,相比较动态,
虽然省去了加载共享模块的步骤,但是也加大了二进制执行文件的空间,变得臃肿。
--enable-deflate=shared 表示共享的方式编译deflate,
既然可以动态共享当然也可以静态方式编译deflate模块。什么是动态和静态?apache编译安装完成后会生成一个核心的二进制可执行文件叫做
httpd,这个文件作为核心文件,提供服务时就是它在处理用户的请求,但是有一些功能,比如提到的expires就是配置静态文件、图片过期时间的,
也就是说图片可以再用户浏览器的临时缓存目录中缓存多久。这些功能是作为httpd的一个扩展模块来工作的,那么这种扩展模块有两种存在的方式,
一种是直接在编译的时候和httpd文件拧到一起,组成一个体积大的文件,这种叫做静态。另一种,扩展模块作为独立的文件存在,只有在使用这个模
块时再去调用它,这种叫做动态共享。动态的好处是,核心文件httpd比较小,模块随时用随时加载,耗费内存小队较少。静态的优势,在服务启动
时,会把所有模块加载,用到时很快执行,效率较高。
--enable-expires=shared 共享的方式编译 expires
--enable-rewrite=shared 共享的方式编译 rewrite
#yum install -y pcre pcre-devel apr apr-devel 【make之前安装这些包,避免出错】
#make
#echo $?
#make install
#echo $?
启动验证
# /usr/local/apache2/bin/apachectl start 【启动程序】
# ps aux |grep httpd 【验证是否启动】
# netstat -nlp 【检查监听端口是不是80】
常用选项:
-M 列出所有模块,主要是查看动态模块# /usr/local/apache2/bin/apachectl -M
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
include_module (static)
filter_module (static)
log_config_module (static)
env_module (static)
setenvif_module (static)
version_module (static)
mpm_prefork_module (static)
http_module (static)
mime_module (static)
status_module (static)
autoindex_module (static)
asis_module (static)
cgi_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
so_module (static)
deflate_module (shared)
expires_module (shared)
rewrite_module (shared)
# ls /usr/local/apache2/modules/ 【动态模块存放路径,下图绿色的为动态共享模块】
# ls /usr/local/apache2/bin/httpd 【静态模块存放文件】
静态文件模块是将上述静态模块全部编译层进这个httpd文件内。
-L 【只列出静态模块】
# /usr/local/apache2/bin/apachectl -l
-t 【查看配置文件有没有错误】
# /usr/local/apache2/bin/apachectl -t
Syntax OK
配置文件路径 /usr/local/apache2/conf/httpd.conf
NOTE:
1、重新加载httpd有两种选项
# /usr/local/apache2/bin/apachectl restart
# /usr/local/apache2/bin/apachectl graceful
resatart这个选项要先把httpd进程杀死,再重新加载。
graceful,原来的进程还在,只是把配置文件重新加载2、工作模式
#cd /usr/local/src/httpd-2.2.24
#./configure --help
--with-mpm=MPM
Choose the process model for Apache to use.
MPM={beos|event|worker|prefork|mpmt_os2|winnt}
--with-mpm=MPM这个选项可以指定工作模式,常用的是 worker , prefork, event。
下载解压就不说了。
配置编译参数:
#cd http-2.2.24
#vim INSTALL
#./configure \
--prefix=/usr/local/apache2 \
--with-included-apr \
--enable-so \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--with-pcre
--prefix 指定安装到哪里,
--with-included-apr \
底层的一个模块,是数据可以跨平台使用。
--enable-so 表示启用DSO
DSO 是 Dynamic Shared Objects (动态共享目标)的缩写,它提供了一种在运行时将特殊格式的代码在程序运行需要时,将需要的部分从外存调
入内存执行的方法。 Apache 支持动态共享模块,也支持静态模块,静态的话,会把需要的目标直接编译进 apache 的可执行文件中,相比较动态,
虽然省去了加载共享模块的步骤,但是也加大了二进制执行文件的空间,变得臃肿。
--enable-deflate=shared 表示共享的方式编译deflate,
既然可以动态共享当然也可以静态方式编译deflate模块。什么是动态和静态?apache编译安装完成后会生成一个核心的二进制可执行文件叫做
httpd,这个文件作为核心文件,提供服务时就是它在处理用户的请求,但是有一些功能,比如提到的expires就是配置静态文件、图片过期时间的,
也就是说图片可以再用户浏览器的临时缓存目录中缓存多久。这些功能是作为httpd的一个扩展模块来工作的,那么这种扩展模块有两种存在的方式,
一种是直接在编译的时候和httpd文件拧到一起,组成一个体积大的文件,这种叫做静态。另一种,扩展模块作为独立的文件存在,只有在使用这个模
块时再去调用它,这种叫做动态共享。动态的好处是,核心文件httpd比较小,模块随时用随时加载,耗费内存小队较少。静态的优势,在服务启动
时,会把所有模块加载,用到时很快执行,效率较高。
--enable-expires=shared 共享的方式编译 expires
--enable-rewrite=shared 共享的方式编译 rewrite
#yum install -y pcre pcre-devel apr apr-devel 【make之前安装这些包,避免出错】
#make
#echo $?
#make install
#echo $?
启动验证
# /usr/local/apache2/bin/apachectl start 【启动程序】
# ps aux |grep httpd 【验证是否启动】
# netstat -nlp 【检查监听端口是不是80】
常用选项:
-M 列出所有模块,主要是查看动态模块# /usr/local/apache2/bin/apachectl -M
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
include_module (static)
filter_module (static)
log_config_module (static)
env_module (static)
setenvif_module (static)
version_module (static)
mpm_prefork_module (static)
http_module (static)
mime_module (static)
status_module (static)
autoindex_module (static)
asis_module (static)
cgi_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
so_module (static)
deflate_module (shared)
expires_module (shared)
rewrite_module (shared)
# ls /usr/local/apache2/modules/ 【动态模块存放路径,下图绿色的为动态共享模块】
# ls /usr/local/apache2/bin/httpd 【静态模块存放文件】
静态文件模块是将上述静态模块全部编译层进这个httpd文件内。
-L 【只列出静态模块】
# /usr/local/apache2/bin/apachectl -l
-t 【查看配置文件有没有错误】
# /usr/local/apache2/bin/apachectl -t
Syntax OK
配置文件路径 /usr/local/apache2/conf/httpd.conf
NOTE:
1、重新加载httpd有两种选项
# /usr/local/apache2/bin/apachectl restart
# /usr/local/apache2/bin/apachectl graceful
resatart这个选项要先把httpd进程杀死,再重新加载。
graceful,原来的进程还在,只是把配置文件重新加载2、工作模式
#cd /usr/local/src/httpd-2.2.24
#./configure --help
--with-mpm=MPM
Choose the process model for Apache to use.
MPM={beos|event|worker|prefork|mpmt_os2|winnt}
--with-mpm=MPM这个选项可以指定工作模式,常用的是 worker , prefork, event。
阅读全文
0 0
- LAMP搭建——apache安装
- 搭建Lamp之安装apache
- 搭建LAMP 环境 细节:--- 安装apache
- LAMP服务器环境搭建三、apache安装
- LAMP搭建之Apache(源码安装)
- LAMP搭建——mysql安装
- LAMP搭建——PHP安装
- 虚拟机CentOS7最小化安装下源码编译搭建LAMP环境之二: ————Apache编译安装
- ubuntu搭建LAMP环境——apache、mysql、php
- 【LAMP环境搭建】MariaDB安装和Apache安装
- LAMP服务器环境搭建四、Apache扩展的安装
- 用Virtualbox搭建LAMP环境-2.安装Apache server
- 在startos上搭建LAMP之安装apache
- CentOS下LAMP环境搭建之一源码编译安装apache
- centos7源码安装apache+mysql+php搭建LAMP
- LAMP-1安装apache
- LAMP之安装Apache
- 安装Lamp环境(Apache)
- 引用类型(三)——基本包装类型(一)
- 无线dBm, RSSI, mW的换算关系
- 1、编码器的简单认识
- Entity Framework Code Firs 数据迁移与更新
- hibernate5(1)新特性展示
- LAMP搭建——apache安装
- 剑指offer中atoi()函数的实现
- J2EE进阶之onsubmit表单提交 五
- 牛x的大甲方信息系统为啥对自动化巡检情有独钟
- 最常用的15大Eclipse开发快捷键技巧
- Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the buil
- 内外网双网卡配置
- Linux下的C语言函数perror
- Git的使用(一些常用命令)