源码编译安装nginx
来源:互联网 发布:python学多久 编辑:程序博客网 时间:2024/06/05 05:12
源码编译安装基本步骤:
1、下载
2、解压源码包
3、准备编译环境
4、检查(依赖,兼容),预编译
5、编译
6、安装
所以nginx的源码编译安装也是基本的6步:
1、下载源码
http://nginx.org/,单击download,下载最新的stable的源码
2、解压源码包
[root@master ~]# tar -zxvf nginx-1.10.2.tar.gz
3、准备编译环境
[root@master ~]# yum grouplist | grep Development
Additional Development
Desktop Platform Development
Development tools
Server Platform Development
[root@master ~]# yum groupinstall -y Development Tools
4、检查(依赖,兼容),预编译
[root@master nginx-1.10.2]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
4.1 查看帮助
[root@master nginx-1.10.2]# ./configure --help
--help print this message
--prefix=PATH set installation prefix
--sbin-path=PATH set nginx binary pathname
...................
4.2 预编译,设置安装路径
[root@master nginx-1.10.2]# ./configure --prefix=/opt/nginx-1.10.2
...........
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
4.3 安装依赖
[root@master nginx-1.10.2]# yum search pcre
Loaded plugins: fastestmirror
pcre-devel.i686 : Development files for pcre
pcre-devel.x86_64 : Development files for pcre
pcre-static.x86_64 : Static library for pcre
pcre.i686 : Perl-compatible regular expression library
pcre.x86_64 : Perl-compatible regular expression library
[root@master nginx-1.10.2]# yum install -y pcre-devel
4.4 再次预编译,安装依赖
[root@master nginx-1.10.2]# ./configure --prefix=/opt/nginx-1.10.2
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
[root@master nginx-1.10.2]# yum search zlib
jzlib.x86_64 : JZlib re-implementation of zlib in pure Java
jzlib-demo.x86_64 : Examples for jzlib
jzlib-javadoc.x86_64 : Javadoc for jzlib
perl-Compress-Raw-Zlib.x86_64 : Low-Level Interface to the zlib compression library
perl-Compress-Zlib.x86_64 : A module providing Perl interfaces to the zlib compression library
perl-IO-Zlib.x86_64 : Perl IO:: style interface to Compress::Zlib
zlib.i686 : The zlib compression and decompression library
zlib.x86_64 : The zlib compression and decompression library
zlib-devel.i686 : Header files and libraries for Zlib development
zlib-devel.x86_64 : Header files and libraries for Zlib development
zlib-static.x86_64 : Static libraries for Zlib development
[root@master nginx-1.10.2]# yum install -y zlib-devel
4.5 重复执行预编译,直到没有错误
[root@master nginx-1.10.2]# ./configure --prefix=/opt/nginx-1.10.2
nginx path prefix: "/opt/nginx-1.10.2"
nginx binary file: "/opt/nginx-1.10.2/sbin/nginx"
nginx modules path: "/opt/nginx-1.10.2/modules"
nginx configuration prefix: "/opt/nginx-1.10.2/conf"
nginx configuration file: "/opt/nginx-1.10.2/conf/nginx.conf"
nginx pid file: "/opt/nginx-1.10.2/logs/nginx.pid"
nginx error log file: "/opt/nginx-1.10.2/logs/error.log"
nginx http access log file: "/opt/nginx-1.10.2/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
5、编译
[root@master nginx-1.10.2]# make
................
make[1]: Leaving directory `/root/nginx-1.10.2'
6、安装
[root@master nginx-1.10.2]# make install
make -f objs/Makefile install
.............
make[1]: Leaving directory `/root/nginx-1.10.2'
[root@master nginx-1.10.2]# cd /opt/nginx-1.10.2/
[root@master nginx-1.10.2]# ls
conf html logs sbin
7 、启动服务
[root@master nginx-1.10.2]# ./sbin/nginx
- Nginx源码编译安装
- 源码编译安装Nginx
- 源码编译安装nginx
- 源码编译安装nginx
- Nginx源码编译安装
- CentOS源码编译安装Nginx
- Linux 利用nginx源码编译安装nginx
- CentOS6.3源码编译安装nginx
- ubuntu linux 源码编译安装NGINX
- nginx在cygwin源码编译和安装
- 源码编译安装Nginx全程视频演示
- centos6.7 源码编译安装nginx
- Linux系统 - 源码编译安装Nginx
- Linux系统 - 源码编译安装Nginx
- Linux(CentOS) - 源码编译安装Nginx
- 源码编译和安装nginx、mysql
- Ubuntu nginx php7 源码编译安装
- 源码编译安装 apache, nginx, axel
- Java Script初探
- poj3026——Borg Maze(BFS+最小生成树)
- EE-Club 刻意练习有效反馈
- Android5.0隐式启动服务
- 数据结构与算法分析笔记与总结(java实现)--链表17:无环单链表判断是否相交问题
- 源码编译安装nginx
- LightOJ 1049 One Way Roads
- servlet与jsp的关系
- 数据结构与算法分析笔记与总结(java实现)--链表18:有环单链表判断是否相交问题
- C语言——系统函数和库函数的区别
- 【BZOJ 1475】方格取数 最大点权独立集
- 我的第一次
- git 生成远程develop分支的copy分支
- 寄生组合式继承