NGINX安装配置与认证全解析
1. 不同工具安装配置NGINX
1.1 Puppet安装配置NGINX
- 问题 :需要使用Puppet安装和配置NGINX,将NGINX配置作为代码进行管理,并与其他Puppet配置保持一致。
- 解决方案 :创建一个模块来安装NGINX,管理所需文件,并确保NGINX正在运行。
class nginx {
package {"nginx": ensure => 'installed',}
service {"nginx":
ensure => 'true',
hasrestart => 'true',
restart => '/etc/init.d/nginx reload',
}
file { "nginx.conf":
path => '/etc/nginx/nginx.conf',
require => Package['nginx'],
notify => Service['nginx'],
content => template('nginx/templates/nginx.conf.erb'),
user=>'root',
group=>'root',
mode='0644';
}