美文网首页
腾讯云服务器安全配置

腾讯云服务器安全配置

作者: 科科分享 | 来源:发表于2018-01-16 21:19 被阅读0次

系统 

1、iptables

配置iptables

iptables 的最大优点是它可以配置有状态的防火墙

关闭默认防火墙firewall

systemctl stop firewalld.service #停止

firewall systemctl disable firewalld.service #禁止

firewall开机启动 firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

安装iptables

yum install iptables-services

默认只开放22端口,如果需要配置更多端口

vim /etc/sysconfig/iptables

*filter :INPUT DROP [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [26:2314]

-A INPUT -i lo -j ACCEPT

-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT

-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT COMMIT

:wq! #保存退出

2、修改默认ssh远程端口

vim /ect/ssh/sshd_config

#Prot 22

修改为

Prot 88888 # 88888为自定义设置远程端口

/etc/init.d/sshd restart  # 重启SSH使配置生效

在iptables修改22规则

-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

修改为

-A INPUT -p tcp -m tcp --dport 88888 -j ACCEPT

 systemctl restart iptables.service # 最后重启防火墙使配置生效

现在就可以用88888端口远程登录了

3、LNMP

安装LNMP稳定版,按指示操作,可选择mysql、php版本,设置密码等

wget -c http://soft.vpser.net/lnmp/lnmp1.4.tar.gz && tar zxf lnmp1.4.tar.gz && cd lnmp1.4 && ./install.sh lnmp

相关文章

网友评论

      本文标题:腾讯云服务器安全配置

      本文链接:https://www.haomeiwen.com/subject/khhngxtx.html