龙芯3a5000下编译nginx源码

1.nginx源码获取

http://hg.nginx.org/nginx

  选择tag,选择稳定版本1.22,点击gz下载gz压缩格式的源码。

2.编译环境需要安装一大堆依赖,不过我测试这台机器因为之前尝试编译过gcc及redis等,pcre,openssl,zlib等都比较全,这里就不再写编译依赖的安装准备过程了。

3.解压缩nginx源码,然后进入解压缩路径,执行./auto/configure --with-http_ssl_module --with-http_mp4_module --with-http_flv_module

龙芯3a5000下编译nginx源码_第1张图片

4.编译安装

make  && make install

ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx

nginx -V 信息如下:

nginx version: nginx/1.22.0
built by gcc 8.3.0 (Loongnix 8.3.0-6.lnd.vec.30) 
built with OpenSSL 1.1.1d  10 Sep 2019
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-http_mp4_module --with-http_flv_module

5.安装nginx为systemd服务

vi /lib/systemd/system/nginx.service

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

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

  systemctl daemon-reload

  systemctl enable nginx

  systemctl start nginx

  systemctl status nginx

  龙芯3a5000下编译nginx源码_第2张图片

你可能感兴趣的:(IT技术相关,nginx,服务器,运维)