[运维] 在飞腾FT2000+平台上编译安装nginx

系统环境说明

系统:CentOS-7-aarch64-Minimal-2009
平台:aarch64
CPU 型号:FT2000+

参考文献

Building nginx from Sources

Nginx编译环境搭建

源码下载

下载nginx源代码

下载地址

依赖安装

安装gccopenssl-develsqlite-develbzip2-develreadline-devel

sudo yum install gcc openssl-devel bzip2-devel readline-devel

编译安装Nginx

nginx-1.19.5.tar.gz示例编译安装nginx

# 在设备上解压源代码
tar xf nginx-1.19.5.tar.gz
cd nginx-1.19.5

# 配置编译环境
./configure --with-http_ssl_module --with-http_v2_module
## 编译
make -j8
## 安装
make install

创建服务启动文件

编辑/usr/lib/systemd/system/nginx.service

vim /usr/lib/systemd/system/nginx.service

添加以下内容

[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
# Nginx will fail to start if /usr/local/nginx/logs/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=mixed
PrivateTmp=true

[Install]
WantedBy=multi-user.target

设置开机启动

#使用systemctl设置
sudo systemctl daemon-reload                 #让系统知道新的单元文件
sudo systemctl enable nginx      #让系统开机启动这个服务器
sudo systemctl start nginx         #启动这个服务器
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值