itamae/cookbooks/nginx/default.rb

56 lines
1.1 KiB
Ruby
Raw Normal View History

2019-03-03 08:50:49 +00:00
# Retrieve the default values:
include_recipe './attributes.rb'
# Kernel Parameters:
include_recipe './kernel.rb'
2021-05-01 09:22:31 +00:00
# Create the necessary directories:
%w( body fastcgi proxy scgi uwsgi ).each do |d|
directory "/var/lib/nginx/#{d}" do
owner 'www-data'
group 'root'
mode '755'
end
end
%w( /etc/nginx/sites-enabled /etc/nginx/stream-enabled ).each do |d|
directory d do
owner 'root'
group 'root'
mode '0755'
end
end
# Deploy the nginx configuration files:
%w(nginx.conf basic-auth).each do |f|
remote_file "/etc/nginx/#{f}" do
owner 'root'
group 'root'
mode '644'
notifies :reload, 'service[nginx]'
end
end
2019-03-03 08:50:49 +00:00
# Prerequisites for Building nginx:
if !node['nginx']['skip_webadm']
2021-09-23 10:14:28 +00:00
include_recipe './webadm.rb'
end
# Build nginx:
include_recipe './build.rb'
# Check whether to deploy the nginx confings:
if !node['nginx']['skip_deploy_conf']
include_recipe '../blog/default.rb'
include_recipe '../everun/default.rb'
2021-09-23 10:14:28 +00:00
end
2019-03-03 08:50:49 +00:00
2020-10-10 13:08:21 +00:00
# Install Let's Encrypt:
if !node['nginx']['skip_lego']
2021-09-23 10:14:28 +00:00
include_recipe './lego.rb'
end
2020-10-10 13:08:21 +00:00
2019-03-03 08:50:49 +00:00
# Setup nginx:
include_recipe './setup.rb'