linux 查找大文件 命令
find / -type f -size +200M
find / -type f -size +200M
rm -rf /www 范例 删除www目录
本文介绍iptables这个Linux下最强大的防火墙工具,包括配置iptables三个链条的默认规则、添加iptables规则、修改规则、删除规则等。
一、查看规则集
iptables --list -n // 加一个-n以数字形式显示IP和端口,看起来更舒服
二、配置默认规则
iptables -P INPUT DROP // 不允许进
iptables -P FORWARD DROP // 不允许转发
iptables -P OUTPUT ACCEPT // 允许出
三、增加规则
iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT
//允许源IP地址为192.168.0.0/24网段的包流进(包括所有的协议,这里也可以指定单个IP)
iptables -A INPUT -d 192.168.0.22 -j ACCEPT
//允许所有的IP到192.168.0.22的访问
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
//开放本机80端口
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
//开放本机的ICMP协议
四、删除规则
iptables -D INPUT -s 192.168.0.21 -j ACCEPT
//删除刚才建立的第一条规则
五、规则的保存
iptables -F
//清空规则缓冲区(这个操作会将上面的增加操作全部清空,若须保留建议先执行一下句:保存)
service iptables save
//将规则保存在/etc/sysconfig/iptables文件里
service iptables restart
//重启Iptables服务
最后说明一下,iptables防火墙的配置文件存放于:/etc/sysconfig/iptables
当前位置: 洪哥笔记 > Linux > iptables防火墙规则的添加、删除、修改、保存
iptables防火墙规则的添加、删除、修改、保存
关键词
Linux iptables 规则
摘要
本文介绍iptables这个Linux下最强大的防火墙工具,包括配置iptables三个链条的默认规则、添加iptables规则、修改规则、删除规则等。
本文介绍iptables这个Linux下最强大的防火墙工具,包括配置iptables三个链条的默认规则、添加iptables规则、修改规则、删除规则等。
一、查看规则集
iptables --list -n // 加一个-n以数字形式显示IP和端口,看起来更舒服
二、配置默认规则
iptables -P INPUT DROP // 不允许进
iptables -P FORWARD DROP // 不允许转发
iptables -P OUTPUT ACCEPT // 允许出
三、增加规则
iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT
//允许源IP地址为192.168.0.0/24网段的包流进(包括所有的协议,这里也可以指定单个IP)
iptables -A INPUT -d 192.168.0.22 -j ACCEPT
//允许所有的IP到192.168.0.22的访问
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
//开放本机80端口
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
//开放本机的ICMP协议
四、删除规则
iptables -D INPUT -s 192.168.0.21 -j ACCEPT
//删除刚才建立的第一条规则
五、规则的保存
iptables -F
//清空规则缓冲区(这个操作会将上面的增加操作全部清空,若须保留建议先执行一下句:保存)
service iptables save
//将规则保存在/etc/sysconfig/iptables文件里
service iptables restart
//重启Iptables服务
最后说明一下,iptables防火墙的配置文件存放于:/etc/sysconfig/iptables
【原作者】
洪哥----《iptables防火墙规则的添加、删除、修改、保存》
http://www.splaybow.com/post/iptables-rule-add-delete-modify-save.html
后台续传
wget -b -c http://47.92.80.16/gzy.zip
-b 后台运行
-c 续传
1、用户登录
mysql -u 用户(root) -p 密码(123456) -h localhost
2、显示数据库
show databses
3、选择数据库
use demo
4、导入数据库(SQL执行)
source mysql.sql
centos 7.2 安装Nginx和nginx-rtmp-module搭建直播流媒体服务器
本机安装目录
/usr/share/
1、在当前目录下载同版本的Nginx
cd /usr/share/
wget http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
2、更新下依赖相关包
yum -y install pcre*
3、下载nginx-rtmp-module
cd /usr/share/
git clone https://github.com/arut/nginx-rtmp-module.git
mv nginx-rtmp-module nginx-rtmp-module-1.1.10
4、进入nginx-1.12.2目录
cd /usr/share/nginx-1.12.2
5、编译模块
./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module-1.1.10 --with-
http_ssl_module
make #验证
make install
6、启动Nginx
cd /usr/local/nginx
./sbin/nginx
7、配置conf
参考资料
github:《nginx-rtmp-module》https://github.com/arut/nginx-rtmp-module
复制一份副本
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
编辑配置
vi /usr/local/nginx/conf/nginx.conf
rm -rf /usr/local/nginx/conf/.nginx.conf.swp
在events {}下面添加以下代码
参考《Nginx.conf》
nginx.rar
rtmp_auto_push on; # Multi-Worker
rtmp {
server {
listen 1935;
chunk_size 4096; #//数据传输块的大小
allow play all;
application live {
live on; # 启用rtmp
#publish_notify on; # 启用notify
# on_publish http://127.0.0.1/notify/publish;
# on_play http://127.0.0.1:8080/rtmp/notify/play;
# on_play_done http://127.0.0.1:8080/rtmp/notify/play_done;
# on_publish_done http://127.0.0.1/notify/publish_done;
# on_record_done http://127.0.0.1:8080/rtmp/notify/record_done;
# on_update http://127.0.0.1:8080/rtmp/notify/update;
hls on; # 启用hls
wait_key on; #对视频切片进行保护,这样就不会产生马赛克了
hls_path /www/web/default/live; #切片视频文件存放位置
hls_fragment 10s; #每个视频切片的时长
hls_continuous on; #连续模式
hls_cleanup on; #对多余的切片进行删
# hls_plahls_nested on; #嵌套模式
record all;
record_path /www/web/default/vod; # 录制保存地址
#record_append on;
record_unique on;
#record keyframes;
#record_path /www/web/default/vod;
#record_max_frames 100;
#record_interval 20m;
#exec /usr/local/ffmpeg-3.4-64bit-static/ffmpeg -i rtmp://localhost/live/$name -threads 1 -c:v libx264 -profile:v baseline -b:v 350K -s 640x360 -f flv -c:a aac -ac 1 -strict -2 -b:a 56k rtmp://localhost/live360p/$name;
# 跟踪客户信息
exec_play bash -c "echo $addr $pageurl >> /tmp/clients";
exec_publish bash -c "echo $addr $flashver >> /tmp/publishers";
# 转换录制的文件格式的MP4
# exec_record_done /usr/local/ffmpeg-3wp:4-64bit-static/ffmpeg -y -i $path -acodec libmp3lame -ar 44100 -ac 1 -vcodec libx264 $dirname/$basename.mp4;
}
# application live360p {
# live on;
# hls on; # 启用hls
# hls_path /home/live360p;
# record off;
# allow publish 127.0.0.1;
# deny publish all;
# }
}
}
在http{}前
8、nginx相关命令
/usr/local/nginx/sbin/nginx -s reload #重载配置
/usr/local/nginx/sbin/nginx -s stop #停止
/usr/local/nginx/sbin/nginx #开启
9、添加端口开放
firewall-cmd --query-port=1935/tcp
firewall-cmd --permanent --zone=public --add-port=1935/tcp
systemctl restart firewalld.service
10、设置开机启动
vi /lib/systemd/system/nginx.service
服务代码描述:
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
保存后重载下服务
systemctl daemon-reload
命令详解:
systemctl enable nginx.service #启动服务
systemctl status nginx.service #查看服务状态
systemctl start nginx.service #开启服务
systemctl stop nginx.service #停止服务
systemctl restart nginx.service #重启服务
11、检查推流端口是否正常
cmd
telnet 140.143.157.56 1935
12、直播目录
live /www/web/default/live
vod /www/web/default/vod
13、推流地址
直播地址:rtmp://140.143.157.56/live/
串码:1111
用惯了windows的人,会习惯性地按Ctrl+S来保存,
当你在使用vi insert 保存应该用 命令模式--wq退出 而不是ctrl+s
估计你就是这么做的.
而该举动在vi中的结果就是将vi冻住
用Ctrl+Q可以解冻