nginx主机添加
AddNginxHost(){ cat>>/etc/nginx/conf/$1.conf<<EOF server { listen 80; listen 443; server_name www.$1 $1; access_log /var/log/httpd/$1.log; location /{ proxy_set_header Host \$host; proxy_set_header X-Forwarded-For \$remote_addr; proxy_pass http://$2; } } EOF }
function banip () { cat>/etc/nginx/ip/$1<<EOF deny $1; if (\$remote_addr = "$1"){return 400;} if (\$http_x_forwarded_for = "$1"){return 400;} if (\$proxy_add_x_forwarded_for = "$1"){return 400;} EOF nginx -s reload }
function add_stream() { cat > /etc/nginx/stream/$1.conf << EOF server { listen $1:80 reuseport; listen $1:443 reuseport; listen $1:623 udp reuseport; listen $1:5900 reuseport; listen $1:5985 reuseport; listen $1:7578 reuseport; listen $1:5120 reuseport; listen $1:5122 reuseport; listen $1:5123 reuseport; listen $1:7582 reuseport; listen $1:5124 reuseport; listen $1:5126 reuseport; listen $1:5127 reuseport; proxy_connect_timeout 5s; proxy_timeout 20s; proxy_pass $2:\$server_port; } EOF nginx -s reload } add_stream 103.213.246.4 10.0.13.13
snap() { if [ ! -n $1 ]; then exit 0 ;fi lvcreate -L 50G -s -n $1_snap /dev/vg0/$1_img kpartx -av /dev/mapper/vg0-$1_snap mount /dev/mapper/vg0-$1_snap1 /mnt ls /mnt/root/.bash_history }
none