From f55682e5c37f1c66fad0fffb434af44a1d073545 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 1 May 2021 18:22:31 +0900 Subject: [PATCH] Modify `nginx` deploy settings. --- cookbooks/nginx/default.rb | 28 ++++++++++++++++++++++++++++ cookbooks/nginx/setup.rb | 34 ---------------------------------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/cookbooks/nginx/default.rb b/cookbooks/nginx/default.rb index fb4e230..07d52f6 100644 --- a/cookbooks/nginx/default.rb +++ b/cookbooks/nginx/default.rb @@ -4,6 +4,34 @@ include_recipe './attributes.rb' # Kernel Parameters: include_recipe './kernel.rb' +# 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 + # Prerequisites for Building nginx: include_recipe './webadm.rb' diff --git a/cookbooks/nginx/setup.rb b/cookbooks/nginx/setup.rb index bbe449a..0ef7337 100644 --- a/cookbooks/nginx/setup.rb +++ b/cookbooks/nginx/setup.rb @@ -1,37 +1,3 @@ -# 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 - -link '/etc/nginx/sites-enabled' do - to '/home/webadm/repo/nginx-config/sites-available' - user 'root' - - notifies :reload, 'service[nginx]' -end - -link '/etc/nginx/stream-enabled' do - to '/home/webadm/repo/nginx-config/stream-available' - user 'root' - - notifies :reload, 'service[nginx]' -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 - # Log rotation setting: remote_file '/etc/logrotate.d/nginx' do owner 'root'