From 1d6e97f473c05c0bf95ae801b5a6f59144218bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sun, 28 Nov 2021 11:24:50 +0800 Subject: [PATCH] first commit --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/README.md b/README.md index bdb2745..6db7442 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,63 @@ # Upgrade Server +## upgrade openssl+nginx + +```bash +nano build_nginx.sh +#paste the code below +#################################################################################### +#!/bin/bash +wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz --no-check-certificate +tar -zxf openssl-1.1.1g.tar.gz +cd openssl-1.1.1g +./config +sudo apt install make gcc +make -j4 +sudo mv /usr/bin/openssl ~/tmp +sudo make install +sudo ln -s /usr/local/bin/openssl /usr/bin/openssl +sudo ldconfig +cd .. +sudo apt-get install build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev libgd-dev libxml2 libxml2-dev uuid-dev -y +wget http://nginx.org/download/nginx-1.21.1.tar.gz +tar -zxvf nginx-1.21.1.tar.gz +cd nginx-1.21.1 +./configure --prefix=/var/www/html --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --with-pcre --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-http_image_filter_module=dynamic --modules-path=/etc/nginx/modules --with-http_v2_module --with-stream=dynamic --with-http_addition_module --with-http_mp4_module --with-openssl-opt="enable-tls1_3 enable-ec_nistp_64_gcc_128" + +make -j4 +sudo make install +sudo service nginx restart +#################################################################################### +chmod +x build_nginx.sh +sudo ./build_nginx.sh +``` + +## upgrade site + +```bash +nano update_site.sh +#paste the code below +#################################################################################### +#!/bin/bash +source ~/.rvm/scripts/rvm +all_folder=`ls orbit_sites/*/ -d` +pwd=`pwd` +for folder in $all_folder +do + tmp="$pwd/$folder" + if [ "`grep $tmp /etc/nginx/orbit_sites/*`" != "" ] + then + cd "$pwd/$folder" + rm -r public/assets + echo '#123' >> Gemfile + bundle update --all; + git fetch origin + bundle exec bin/rails runner "Rails.env='production';Admin::SitesController.new.git_reset('origin','update');while(1) do (Multithread.where(key: 'update_manager',status: 'finish').count!=0 ? break : nil) end;sleep(5)" + else + echo "$tmp is not site" + fi +done +##################################################################################### +chmod +x update_site.sh +./update_site.sh +```