3-nginx安装

1、下载安装包:
官网提供三个版本:
Mainline version:Mainline 是 Nginx 目前主力在做的版本,可以说是开发版
Stable version:最新稳定版,生产环境上建议使用的版本
Legacy versions:遗留的老版本的稳定版
[root@yidaishengjun local]# wget http://nginx.org/download/nginx-1.20.2.tar.gz
 
2、安装 gcc环境:
[root@yidaishengjun local]# yum install -y gcc-c++
 
3、第三方开发包:
#PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。
#nginx的http模块使用pcre来解析正则表达式,所以需要在linux上安装pcre库。
#注:pcre-devel是使用pcre开发的一个二次开发库。nginx也需要此库。
 
[root@yidaishengjun local]# yum install -y pcre pcre-devel
 
#zlib库提供了很多种压缩和解压缩的方式,nginx使用zlib对http包的内容进行gzip,所以需要在linux上安装zlib库。
 
[root@yidaishengjun local]# yum install -y zlib zlib-devel
 
#OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,
#并提供丰富的应用程序供测试或其它目的使用。
#nginx不仅支持http协议,还支持https(即在ssl协议上传输http),所以需要在linux安装openssl库。
 
[root@yidaishengjun local]# yum install -y openssl openssl-devel
 
[root@yidaishengjun local]# yum -y install libxslt-devel
[root@yidaishengjun local]# yum -y install perl-devel perl-ExtUtils-Embed
 
4、解压nginx安装包:
[root@yidaishengjun local]# mkdir -p nginx
 
[root@yidaishengjun local]# tar -zvxf nginx-1.20.2.tar.gz -C nginx/
 
[root@yidaishengjun nginx]# cd /usr/local/nginx/
[root@yidaishengjun nginx]# mkdir -p nginx
 
5、使用cofigure命令创建一个makeFile文件:
[root@yidaishengjun nginx]# cd nginx-1.20.2/
 
[root@yidaishengjun nginx-1.20.2]#./configure \
--prefix=/usr/local/nginx/nginx/ \
--pid-path=/usr/local/nginx/nginx/nginx.pid \
--lock-path=/usr/local/nginx/nginx/nginx.lock \
--error-log-path=/usr/local/nginx/nginx/log/error.log \
--http-log-path=/usr/local/nginx/nginx/log/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/usr/local/nginx/nginx/client \
--http-proxy-temp-path=/usr/local/nginx/nginx/proxy \
--http-fastcgi-temp-path=/usr/local/nginx/nginx/fastcgi \
--http-uwsgi-temp-path=/usr/local/nginx/nginx/uwsgi \
--http-scgi-temp-path=/usr/local/nginx/nginx/scgi \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-file-aio \
--with-http_realip_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_sub_module \
--with-http_random_index_module \
--with-http_degradation_module \
--with-http_secure_link_module \
--with-http_gzip_static_module \
--with-http_perl_module \
--with-debug \
--with-mail \
--with-mail_ssl_module \
--with-stream
 
6、进入nginx目录执行 make install 命令:
[root@yidaishengjun nginx]# make install
 
7、启动nginx:
[root@yidaishengjun conf]# /usr/local/nginx/nginx/sbin/nginx
 
 
 
参考:http://nginx.org/en/download.html
           https://zhuanlan.zhihu.com/p/83890573
           https://cloud.tencent.com/developer/article/1654844

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值