CENTOS7.9源码安装NGINX过程

大家好,本来希望把生产环境的服务器升级到CENTOS8的,但后来看到CENTOS8已经停止维护了,虽然各大云上支持选择CENTOS8,但实际在安装服务时找不到各种依赖包,实在太无语了,这就是开源的悲催,哈哈,最后退而求期次选择了CENTOS7的最新版CENTOS7.9,费话不多説,开始安装NGINX最新稳定版

一、下载nginx:

nginx: download

Stable version http://nginx.org/download/nginx-1.20.2.tar.gz

cd /usr/local/src/
dnf install pcre-devel openssl openssl-devel
git clone https://github.com/vozlt/nginx-module-vts.git
wget  http://nginx.org/download/nginx-1.20.2.tar.gz
tar zxvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
./configure --prefix=/usr/local/Kaiyuan/nginx --conf-path=/usr/local/Kaiyuan/nginx/conf/nginx.conf --error-log-path=/data/logs/nginx/error.log --http-log-path=/data/logs/nginx/access.log --user=www --group=www --http-client-body-temp-path=/usr/local/Kaiyuan/nginx/tmp/client_body --http-proxy-temp-path=/usr/local/Kaiyuan/nginx/tmp/proxy --http-fastcgi-temp-path=/usr/local/Kaiyuan/nginx/tmp/fastcgi --without-http_uwsgi_module --without-http_scgi_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-cc-opt='-O2 -g' --add-module=../nginx-module-vts --with-http_v2_module
make
make install
groupadd -g 1000 www
useradd -s /sbin/nologin -u 1000 -g www www
mkdir -p /usr/local/Kaiyuan/nginx/tmp/client_body
chown -R www.www /usr/local/Kaiyuan/nginx/tmp
mkdir /usr/local/Kaiyuan/nginx/var
chown -R www.www /usr/local/Kaiyuan/nginx/var

生了service文件

vi /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/Kaiyuan/nginx/sbin/nginx
ExecReload=/usr/local/Kaiyuan/nginx/sbin/nginx -s reload
ExecStop=/usr/local/Kaiyuan/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target

重启

 systemctl daemon-reload
 systemctl enable nginx
 systemctl start nginx

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北漂燕郊杨哥

您的支持是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值