fix error

This commit is contained in:
chiu 2021-02-18 10:38:51 +08:00
parent 197d34a19b
commit 7ffcfc6431
1 changed files with 2 additions and 2 deletions

View File

@ -31,10 +31,10 @@ namespace :create_site do
next next
end end
Net::SSH.start(@site_server.ip , @site_server.account , password: @site_server.password) do |ssh| Net::SSH.start(@site_server.ip , @site_server.account , password: @site_server.password) do |ssh|
nginx_include_dir = exec_ssh_command_by_sudo(ssh,'grep include /etc/nginx/nginx.conf | grep -v "\#\|include /etc/nginx/mime.types\|include /etc/nginx/conf.d/\*.conf\|/etc/nginx/sites-enabled/\*"') nginx_include_dir = exec_command_by_user(ssh,'grep include /etc/nginx/nginx.conf | grep -v "\#\|include /etc/nginx/mime.types\|include /etc/nginx/conf.d/\*.conf\|/etc/nginx/sites-enabled/\*"')
nginx_include_dir = nginx_include_dir.gsub(/include|;|\n/,'').strip nginx_include_dir = nginx_include_dir.gsub(/include|;|\n/,'').strip
domain_name = @site_server.domain_name#'serv.rulingcom.com' domain_name = @site_server.domain_name#'serv.rulingcom.com'
server_names = exec_ssh_command_by_sudo(ssh,"grep 'server_name' -r #{nginx_include_dir}") server_names = exec_command_by_user(ssh,"grep 'server_name' -r #{nginx_include_dir}")
server_names_array = server_names.scan(/(.*):[ \t]*server_name[ \t]+(.*);/) server_names_array = server_names.scan(/(.*):[ \t]*server_name[ \t]+(.*);/)
server_names_array = server_names_array.group_by{|v| v[0]} server_names_array = server_names_array.group_by{|v| v[0]}
server_names_array.each do |nginx_file, server_name_with_file| server_names_array.each do |nginx_file, server_name_with_file|