80端口进不去问题解析

今天啊像往常一样打开我的小网站,发现竟然进不去了。

然后使用网站:    Open Port Check Tool - Test Port Forwarding on Your Router

测了一下80端口ping不通了。

这是我心里暗自感叹自由的巨人,墙外的美丽。我这可怜的仅存的缝隙,终于也被夺走了吗?

但是贫困的我怎么能如此就放弃,毕竟这是我200多买的!

于是我就去找客服理论。并且慢慢发现了事情的真相。好像是我linux服务器的端口没有开发?

不会啊,我在阿里云控制台上打开了啊!

 然后我在SSH页面查看开放端口:

firewall-cmd --list-ports

没有开启80端口。晕。。如果你也是这样,那么你可以输入:

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

解释:

--zone #作用域    --add-port=80/tcp #添加端口,格式为:端口/通讯协议    --permanent #永久生效,没有此参数重启后失效

如果你有其他端口需要开放,也要都开放一遍。

然后重启防火墙:

重启之前确认需要开放的端口都已经加--permanent后缀了,要不然重启后不默认开放。

firewall-cmd --reload

 然后再查看一下端口,发现80端口已经开发,我心爱的小网站又回来了

不用去研究什么端口转发了  快乐@!

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include #include #include #pragma comment(lib, "ws2_32") // Set the packing to a 1 byte boundary #include // // Define the IPv4 header. Make the version and length field one // character since we can't declare two 4 bit fields without // the compiler aligning them on at least a 1 byte boundary. // typedef struct ip_hdr { unsigned char ip_verlen; // 4-bit IPv4 version // 4-bit header length (in 32-bit words) unsigned char ip_tos; // IP type of service unsigned short ip_totallength; // Total length unsigned short ip_id; // Unique identifier unsigned short ip_offset; // Fragment offset field unsigned char ip_ttl; // Time to live unsigned char ip_protocol; // Protocol(TCP,UDP etc) unsigned short ip_checksum; // IP checksum unsigned int ip_srcaddr; // Source address unsigned int ip_destaddr; // Source address } IPV4_HDR, *PIPV4_HDR, FAR * LPIPV4_HDR; // // Define the UDP header // typedef struct udp_hdr { unsigned short src_portno; // Source port no. unsigned short dst_portno; // Dest. port no. unsigned short udp_length; // Udp packet length unsigned short udp_checksum; // Udp checksum (optional) } UDP_HDR, *PUDP_HDR; // Restore the byte boundary back to the previous value #include // // Function: checksum // // Description: // This function calculates the 16-bit one's complement sum // for the supplied buffer. // USHORT checksum(USHORT *buffer, int size) { unsigned long cksum=0; while (size > 1) { cksum += *buffer++; size -= sizeof(USHORT); } if (size) { cksum += *(UCHAR*)buffer; } cksum = (cksum >> 16) + (cksum & 0xffff); cksum += (cksum >>16); return (USHORT)(~cksum);

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值