配置nginx.repo,直接来个yum

# vim /etc/yum.repo.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

# yum-config-manager --enable nginx-stable

# yum install nginx -y

# cat /etc/logrotate.d/nginx  #系统对nginx的日志自动开启了按天进行切割
/var/log/nginx/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 nginx adm
        sharedscripts
        postrotate
                if [ -f /var/run/nginx.pid ]; then
                        kill -USR1 `cat /var/run/nginx.pid`
                fi
        endscript
}

相关文章:

  • 2022-12-23
  • 2022-02-13
  • 2021-09-05
  • 2021-07-01
  • 2021-06-08
  • 2021-12-31
猜你喜欢
  • 2021-05-24
  • 2021-05-07
  • 2021-06-21
  • 2021-07-01
相关资源
相似解决方案