在CentOS 7上安装Nginx 1.10(通过SCL)

首先

使用软件集合(SCL)在CentOS 7上安装Nginx 1.10。
参考:快速入门 – 软件集合

支持

本手法で導入した場合、Red Hat Software Collections Product Life Cycle – Red Hat Customer Portalより、2020-04がEOLだと思われる。
それ以降に報告された脆弱性や不具合への対応は実施されない可能性がある。

日志

注册仓库

# yum install -y centos-release-scl

安装

# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

# yum install -y rh-nginx110 which
# scl enable rh-nginx110 bash
... 略

启动/停止nginx。

# systemctl start rh-nginx110-nginx
# systemctl status -l rh-nginx110-nginx
● rh-nginx110-nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/rh-nginx110-nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-10-14 14:19:07 UTC; 4s ago
  Process: 256 ExecStart=/opt/rh/rh-nginx110/root/usr/libexec/nginx-scl-helper enable $RH_NGINX110_SCLS_ENABLED -- /opt/rh/rh-nginx110/root/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 250 ExecStartPre=/opt/rh/rh-nginx110/root/usr/libexec/nginx-scl-helper enable $RH_NGINX110_SCLS_ENABLED -- /opt/rh/rh-nginx110/root/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 243 ExecStartPre=/opt/rh/rh-nginx110/root/usr/libexec/nginx-scl-helper enable $RH_NGINX110_SCLS_ENABLED -- /usr/bin/scl_enabled rh-nginx110 (code=exited, status=0/SUCCESS)
  Process: 242 ExecStartPre=/usr/bin/rm -f /var/opt/rh/rh-nginx110/run/nginx/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 262 (nginx)
   CGroup: /docker/d476f027fd8ca4236014861f224172816a0f79d0c7afb5ef0fd881adc34d8be2/system.slice/rh-nginx110-nginx.service
           tq262 nginx: master process /opt/rh/rh-nginx110/root/usr/sbin/nginx
           mq263 nginx: worker process
           ? 262 nginx: master process /opt/rh/rh-nginx110/root/usr/sbin/nginx

Oct 14 14:19:06 d476f027fd8c systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 14 14:19:07 d476f027fd8c nginx-scl-helper[250]: nginx: the configuration file /etc/opt/rh/rh-nginx110/nginx/nginx.conf syntax is ok
Oct 14 14:19:07 d476f027fd8c nginx-scl-helper[250]: nginx: configuration file /etc/opt/rh/rh-nginx110/nginx/nginx.conf test is successful
Oct 14 14:19:07 d476f027fd8c systemd[1]: Failed to read PID from file /var/opt/rh/rh-nginx110/run/nginx/nginx.pid: Invalid argument
Oct 14 14:19:07 d476f027fd8c systemd[1]: Started The nginx HTTP and reverse proxy server.
# systemctl stop rh-nginx110-nginx
# systemctl status -l rh-nginx110-nginx
● rh-nginx110-nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/rh-nginx110-nginx.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Oct 14 14:19:06 d476f027fd8c systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 14 14:19:07 d476f027fd8c nginx-scl-helper[250]: nginx: the configuration file /etc/opt/rh/rh-nginx110/nginx/nginx.conf syntax is ok
Oct 14 14:19:07 d476f027fd8c nginx-scl-helper[250]: nginx: configuration file /etc/opt/rh/rh-nginx110/nginx/nginx.conf test is successful
Oct 14 14:19:07 d476f027fd8c systemd[1]: Failed to read PID from file /var/opt/rh/rh-nginx110/run/nginx/nginx.pid: Invalid argument
Oct 14 14:19:07 d476f027fd8c systemd[1]: Started The nginx HTTP and reverse proxy server.
Oct 14 14:19:51 d476f027fd8c systemd[1]: Stopping The nginx HTTP and reverse proxy server...
Oct 14 14:19:51 d476f027fd8c systemd[1]: Stopped The nginx HTTP and reverse proxy server.

自动启动/取消设置NGINX

# systemctl enable rh-nginx110-nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx110-nginx.service to /usr/lib/systemd/system/rh-nginx110-nginx.service.

# systemctl list-unit-files --type=service |grep nginx
rh-nginx110-nginx.service              enabled
# systemctl disable rh-nginx110-nginx
Removed symlink /etc/systemd/system/multi-user.target.wants/rh-nginx110-nginx.service.

# systemctl list-unit-files --type=service |grep nginx
rh-nginx110-nginx.service              disabled

确认的种类

# which nginx
/opt/rh/rh-nginx110/root/usr/sbin/nginx

# nginx -v
nginx version: nginx/1.10.2

# yum info rh-nginx110
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * centos-sclo-rh: ftp-srv2.kddilabs.jp
 * centos-sclo-sclo: ftp-srv2.kddilabs.jp
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
Installed Packages
Name        : rh-nginx110
Arch        : x86_64
Version     : 1.10
Release     : 8.el7
Size        : 0.0
Repo        : installed
From repo   : centos-sclo-rh
Summary     : Package that installs rh-nginx110
License     : GPLv2+
Description : This is the main package for rh-nginx110 Software Collection.

广告
将在 10 秒后关闭
bannerAds