Skip to content

Instantly share code, notes, and snippets.

@odaillyjp
Last active August 29, 2015 14:04
Show Gist options
  • Save odaillyjp/41934068e567b5ab471c to your computer and use it in GitHub Desktop.
Save odaillyjp/41934068e567b5ab471c to your computer and use it in GitHub Desktop.
CentOS に Nginx の最新安定版を入れるレシピ
include_recipe 'yum'
# リポジトリは http://wiki.nginx.org/Install#Official_Red_Hat.2FCentOS_packages を参考
yum_repository 'nginx' do
baseurl "http://nginx.org/packages/centos/#{node[:platform_version].to_i}/#{node[:kernel][:machine]}/"
gpgcheck false
enabled false
action :create
end
yum_package 'nginx' do
options '--enablerepo=nginx'
action :install
end
service 'nginx' do
supports status: true, restart: true
action [:enable, :start]
end
# nginx.conf を書き換えたいならば記述(テンプレートが必要)
#
# template '/etc/nginx/nginx.conf' do
# source 'nginx.conf.erb'
# mode '0644'
# notifies :restart, 'service[nginx]'
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment