CentOS8下nginx-1.19.6编译安装

本文介绍了在CentOS系统下安装和启动Nginx的详细步骤。包括安装依赖包、下载安装包、解压并安装,过程中遇到编译工具缺失问题给出了解决办法,最后进行编译安装,还说明了测试配置文件正确性、启动和重启Nginx的操作。

1、安装依赖包
yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

2、下载安装包
wget http://nginx.org/download/nginx-1.19.6.tar.gz

#打补丁 nginx_upstream_check_module模块
wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz
tar zxvf v0.3.0.tar.gz

3、解压并安装
tar zxvf nginx-1.19.6.tar.gz
cd nginx-1.19.6/

#配置
./configure --prefix=/usr/local/nginx \
        --with-http_stub_status_module \
        --with-http_ssl_module \
        --with-stream \
        --with-file-aio \
        --with-http_realip_module \
        --add-module=../nginx_upstream_check_module-0.3.0 \
            --with-stream_ssl_module

 

./configure: error: C compiler cc is not found
yum install gcc

问题:-bash:make_ command not found
yum -y install gcc automake autoconf libtool make

4、编译安装
make && make install

5、启动
cd /usr/local/nginx
测试文件正确性:./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

启动nginx: ./sbin/nginx
重启nginx: ./sbin/nginx -s reload

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值