银河麒麟V10安装第二个nginx服务
1.跳转到nginx源文件
cd /home/nginx-1.15.9/
2.配置、编译、安装(/usr/local/nginx2 为 Nginx 安装目录)
./configure --prefix=/usr/local/nginx2 --with-http_ssl_module --with-pcre
make && make install
3.进入第二个nginx服务安装目录修改配置,修改监听端口防止重复
cd /usr/local/nginx2/conf
vim nginx.conf
4.设置systemctl管理
# 进入系统服务脚本目录
cd /usr/lib/systemd/system
# 创建ngxin服务相关脚本
vim nginx2.service
[Unit]
Description=nginx - web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx2/logs/nginx.pid
ExecStartPre=/usr/local/nginx2/sbin/nginx -t -c /usr/local/nginx2/conf/nginx.conf
ExecStart=/usr/local/nginx2/sbin/nginx -c /usr/local/nginx2/conf/nginx.conf
ExecReload=/usr/local/nginx2/sbin/nginx -s reload
ExecStop=/usr/local/nginx2/sbin/nginx -s stop
ExecQuit=/usr/local/nginx2/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
5.重新装载systemctl服务
systemctl daemon-reload
#启动服务
systemctl start nginx2.service
#开机启动
systemctl enable nginx2.service
#查看系统服务状态
systemctl status nginx2.service