云服务器修改网站服务器端口、数据库端口

8 篇文章 0 订阅
4 篇文章 0 订阅

为安全需要修改Apache网页默认80端口为8080,mysql数据库端口为2828。

步骤一:天翼云设置安全规则

登陆天翼云网站www.ctyun.cn,登陆进去

控制中心-弹性云主机-选择相应的云主机,进入云主机设置页,选择“安全组”tab,点击“更改安全组规则”编辑现有安全组规则,选择“入方向规则”,点击“添加规则”,分别增加8080和2828端口。

步骤二:修改Apache及Mysql配置文件:

编辑Apache配置文件:/etc/httpd/conf/httpd.conf

将“Listen 80”  改为“Listen 8080” 

编辑Mysql配置文件 : /etc/my.cnf
    修改:port=2828

重启apache: systemctl restart httpd.service

步骤三:开启Centos系统防火墙,让其可以访问这些端口号。

systemctl start firewalld(centos 7.* 开启防火墙指令)

方法一:使用firewall设置

1、开启防火墙后运行命令:
firewall-cmd --get-active-zones
运行完成之后,可以看到zone名称

2、执行如下命令,新增开放8080、2828端口:

firewall-cmd --zone=public --add-port=8080/tcp --permanent

firewall-cmd --zone=public --add-port=2828/tcp --permanent

3、重启防火墙,运行命令:
firewall-cmd --reload

4、查看端口号是否开启,运行命令:
firewall-cmd --query-port=8080/tcp

firewall-cmd --query-port=2828/tcp

方法二:通过修改配置文件开启端口号

1、先打开配置文件

vi /etc/sysconfig/iptables

拷贝一行ACCEPT的, 改一下端口号就可以了

A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
A INPUT -p tcp -m state --state NEW -m tcp --dport 2828 -j ACCEPT

2、最后重启一下防火墙服务

service iptables restart

systemctl start firewalld(开启防火墙)

3、保存防火墙设置

service iptables save

步骤四:重启Apache、Mysql服务,完成。
 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
第3章带宽管理功能命令.....................................................................................................54 3.1 clear double-tagging-vlan statistics.............................................................................54 3.2 clear rate-limit statistics vlan ......................................................................................54 3.3 rate-limit double-tagging-vlan ....................................................................................55 3.4 rate-limit egress...........................................................................................................56 3.5 rate-limit flow-control.................................................................................................57 3.6 rate-limit ingress .........................................................................................................58 3.7 rate-limit port-list ingress............................................................................................59 3.8 rate-limit vlan..............................................................................................................61 3.9 show interface port rate-limit ......................................................................................61 3.10 show rate-limit ............................................................................................................63 3.11 show rate-limit vlan ....................................................................................................64 第4章管理MAC地址表命令................................................................................................66 4.1 clear mac-address-table...............................................................................................66 4.2 mac-address-table aging-time .....................................................................................66 4.3 mac-address-table learning..........................................................................................67 4.4 mac-address-table static multicast...............................................................................68 4.5 mac-address-table static unicast..................................................................................69 4.6 mac-address-table threshold........................................................................................70 4.7 search mac-address .....................................................................................................71 4.8 show mac aging-time ..................................................................................................72 4.9 show mac-address-table l2-address.............................................................................72 4.10 show mac-address-table l2-address count...................................................................73 4.11 show mac-address-table multicast...............................................................................74 4.12 show mac-address-table static.....................................................................................75 4.13 show mac-address-table threshold ..............................................................................76 第5章物理层接口配置命令.................................................................................................78 5.1 clear interface port statistics........................................................................................78 5.2 description...................................................................................................................78 5.3 duplex.........................................................................................................................79 5.4 dynamic statistics time ................................................................................................80 5.5 show interface port......................................................................................................81 5.6 show interface port statistics .......................................................................................82 5.7 show interface port statistics dynamic ........................................................................83 5.8 show system mtu.........................................................................................................86 5.9 shutdown.....................................................................................................................86 5.10 speed ...........................................................................................................................87 5.11 system mtu ..................................................................................................................88 第6章风暴抑制命令.............................................................................................................8

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wenzhp1975

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值