Nginx源码安装手册源码安装手册
蔡建兵 2016-06-01
一、系统环境一、系统环境
nginx版本:1.6.3
操作系统:Centos 6.7 64bit
安装目录:/usr/local/nginx
源码位置:/usr/local/srv
二、准备篇二、准备篇
安装必要的编译工具、依赖包:
[root@localhost /]#yum -y install gcc pcre pcre-devel openssl openssl-devel
三、三、nginx及模块安装篇及模块安装篇
1. 下载nginx服务器并解压进入目录
[root@localhost src]#wget http://nginx.org/download/nginx-1.6.3.tar.gz
[root@localhost src]#tar -xzvf nginx-1.6.3.tar.gz
[root@localhost src]#cd nginx-1.6.3
2. 编译
由于NGINX的模块是直接编译进去Nginx,因此Nginx属于静态编译安装方式。在默认的情况下,经过编译安装的Nginx包含了大部分可用的模块,
可以通过"./configure --help "选项设置各个模块的使用情况,如:
[root@localhost nginx-1.6.3]# ./configure --prefix=/usr/local/nginx \
--user=nginx --group=nginx \
--with-http_stub_status_module --with-http_realip_module
3. 在/etc/init.d/目录上新建nginx自启脚本
[root@localhost src]#touch nginx
[root@localhost src]#chmod +x nginx
[root@localhost src]#vim nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: NGINX is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx.conf
# pidfile: /usr/local/nginx//run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
评论0
最新资源