ubuntu 防火墙设置和nginx升级脚本

ufw version           #查看版本信息
ufw enable            #启用防火墙
ufw disable           #禁用防火墙
ufw reload            #重载防火墙
ufw reset             #重新设置防火墙 (注意:这将禁用UFW并删除之前定义的任何规则)
ufw verbose           #查看防火墙策略


默认情况下ufw开启会阻止所有传入的流量并且允许所有传出的流量,就是通过一下命令实现
ufw allow ssh

ufw allow 80/tcp

ufw allow from 192.168.29.36 to any port 80 proto tcp
ufw allow from 192.168.29.36 to any port 80 proto udp
#拒绝
ufw deny from 192.168.29.36 to any port 80 proto tcp
ufw deny from 192.168.29.36 to any port 80 proto udp


nginx离线升级脚本

#!/bin/bash

 

 


#配置

sudo service nginx stop
sudo apt-get --purge remove nginx -y
tar -zxvf openssl-1.1.1u.tar.gz
tar -zxvf zlib-1.2.13.tar.gz
tar -zxvf pcre-8.45.tar.gz
tar -zxvf nginx-1.24.0.tar.gz

echo "1"


cd pcre-8.45/
sudo ./configure
echo "./configure"
sudo make
echo "make"
sudo make install
echo "make install"
cd ..

echo "4"

cd openssl-1.1.1u/

sudo ./config
echo "./config"

sudo make
echo "make"

sudo make install
echo "make install"

cd ..
echo "2"
cd zlib-1.2.13/

sudo ./configure
echo "./configure"

sudo make
echo "make"

sudo make install
echo "make install"

cd ..

echo "3"

cd nginx-1.24.0/
sudo ./configure --with-http_ssl_module
echo "./configure"
sudo make
echo "make"
sudo make install
echo "make install"
echo "5"

cd /usr/local/nginx/conf/
sudo mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginxback.conf
sudo mv /etc/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf
cd /usr/local/nginx/sbin/

sudo rm /usr/sbin/nginx
sudo ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx

sudo ./nginx

nginx -v

echo "6"

 

 

 

 



posted @ 2023-07-10 13:53  Persnoa  阅读(85)  评论(0编辑  收藏  举报