银河麒麟服务器版V10-编译安装nginx

银河麒麟服务器版V10-编译安装nginx

1、海光芯片(x86架构)、银河麒麟v10sp3

2、下载所需版本的nginx源码
https://nginx.org/en/download.html

3、通过ftp工具上传到服务器中

4、解压
tar -zxvf nginx-1.24.0.tar.gz

5、执行configure配置编译环境,可以保持默认,也可以根据需要添加具体的参数
cd nginx-1.24.0
./configure

默认配置如下

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

6、编译
make

7、安装
make install

8、编写控制脚本
cd /usr/lib/systemd/system
vim nginx.service

[Unit]
Description=nginx service
After=network.target 
   
[Service] 
Type=forking 
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true 
   
[Install] 
WantedBy=multi-user.target

9、通过systemctl命令控制nginx

#查看nginx状态
systemctl status nginx.service
#启动nginx 
systemctl start nginx.service
#停止nginx
systemctl stop nginx.service
#重启nginx
systemctl restart nginx.service
#开启开机启动nginx 
systemctl enable nginx.service 
#关闭开机启动nginx 
systemctl disable nginx.service 

小尾巴~~
只要有积累,就会有进步

你可能感兴趣的:(linux,nginx,银河麒麟,海光)