1, 下载 NGINX 编译包
wget http://nginx.org/download/nginx-1.6.3.tar.gz
2, 创建 nginx 软件所需的用户与组
- [root@localhost software]# useradd www -s /sbin/nologin -M #不能登陆, 不带家目录
- [root@localhost software]# groupadd www #创建组
3, 安装 nginx 所需要的依赖包
[root@localhost software]# yum -y install pcre pcre-devel gcc-c++ zlib-devel zlib open-ssl openssl-devel
4, 开始安装 NGINX
- [root@localhost software]# tar -zxvf nginx-1.6.3.tar.gz
- [root@localhost software]# cd nginx-1.6.3
- [root@localhost nginx-1.6.3]# ./configure --user=www --group=www --with-http_ssl_module --prefix=/app/nginx-1.6.3
- [root@localhost nginx-1.6.3]# make && make install
- [root@localhost nginx-1.6.3]# ll /app/nginx-1.6.3/ #安装成功
总用量 16
drwxr-xr-x 2 root root 4096 7 月 16 11:32 conf
drwxr-xr-x 2 root root 4096 7 月 16 11:32 html
drwxr-xr-x 2 root root 4096 7 月 16 11:32 logs
drwxr-xr-x 2 root root 4096 7 月 16 11:32 sbin
5, 查看 nginx 当前安装了那些模块
- [root@localhost nginx-1.6.3]# ./sbin/nginx -V
- nginx version: nginx/1.6.3
- built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
- TLS SNI support enabled
- configure arguments: --user=www --group=www --with-http_ssl_module --prefix=/app/nginx-1.6.3
6, 给当前安装的 NGINX 添加一个新模块功能, 如: 状态模块 --with-http_stub_status_module
来源: http://www.bubuko.com/infodetail-2687336.html