首页 > 系统服务 > 详细

安装Nginx到Linux(源码)

时间:2020-02-28 17:01:55      阅读:48      评论:0      收藏:0      [点我收藏+]

运行环境

系统版本:无
软件版本:无
硬件要求:无

安装过程

NGINX官方提供源码包的下载,NGINX有两个版本Mainline(主线)版和Stable(稳定)版。主线版本我们可以理解为是开发版本,在生产环境中建议使用稳定版本。
源码安装适用于所有Linux操作系统。
NGINX官方下载地址:http://nginx.org/en/download.html。

1、下载软件包

[root@localhost ~]# wget http://nginx.org/download/nginx-1.14.0.tar.gz

2、解压软件包

[root@localhost ~]# tar xzvf nginx-1.14.0.tar.gz 
[root@localhost ~]# ls
nginx-1.14.0  nginx-1.14.0.tar.gz

3、安装相关依赖

[root@localhost ~]# yum -y install gcc gcc-c++ autoconf automake pcre pcre-devel zlib zlib-devel openssl openssl-devel gd-devel

4、配置、编译并安装

[root@localhost ~]# cd nginx-1.14.0
[root@localhost nginx-1.14.0]# ./configure --prefix=/usr/local/nginx/ --with-threads --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module=dynamic --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-stream=dynamic --with-compat
[root@localhost nginx-1.14.0]# make -j4 && make install

5、配置环境变量

配置环境变量,使Nginx命令在全局使用。

[root@localhost sbin]# vim /etc/profile
export NGINX_PATH=/usr/local/nginx/sbin
export PATH=$PATH:$NGINX_PATH
[root@localhost sbin]# source /etc/profile

6、查看NGINX的版本及编译选项

[root@localhost conf]# nginx -V
nginx version: nginx/1.14.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx/ --with-threads --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module=dynamic --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-stream=dynamic --with-compat

安装Nginx到Linux(源码)

原文:https://www.cnblogs.com/network-ren/p/12377764.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!