Chrome 错误代码:ERR_UNSAFE_PORT 的解决方法

举报
沈唁 发表于 2021/06/23 13:09:35 2021/06/23
【摘要】 大多数情况,是因为 6666 让我们相遇 😆最近在使用一个服务的时候,监听的端口为:6666,例如:$http = new Swoole\Http\Server('0.0.0.0', 6666);$http->on('Request', function ($request, $response) { $response->header('Content-Type', 'text/h...

大多数情况,是因为 6666 让我们相遇 😆

最近在使用一个服务的时候,监听的端口为:6666,例如:

$http = new Swoole\Http\Server('0.0.0.0', 6666);

$http->on('Request', function ($request, $response) {
    $response->header('Content-Type', 'text/html; charset=utf-8');
    $response->end('<h1>Hello Swoole. #' . rand(1000, 9999) . '</h1>');
});

$http->start();

当访问对应的服务的时候 Chrome 浏览器却无法正常访问,报错无法访问此网站

网址为 http://127.0.0.1:6666/ 的网页可能暂时无法连接,或者它已永久性地移动到了新网址。
ERR_UNSAFE_PORT

看一眼错误代码,不安全的端口 ❓ ❓ ❓

Mac 的修改比较麻烦,Windows 的简单些,选中 Google Chrome 快捷方式,右键属性,在 “模板目标” 对应文本框添加:

--explicitly-allowed-ports=87,6666

允许多个端口以逗号隔开,最终如下:

C:\Users\Shenyan\AppData\Local\Google\Chrome\Application\chrome.exe  --explicitly-allowed-ports=6666,556

如果不想修改浏览器设置的就改用其它端口吧

以下是 Chrome 上所有受限端口的列表:

资料来源:googlesource

1,      // tcpmux
7,      // echo
9,      // discard
11,     // systat
13,     // daytime
15,     // netstat
17,     // qotd
19,     // chargen
20,     // ftp data
21,     // ftp access
22,     // ssh
23,     // telnet
25,     // smtp
37,     // time
42,     // name
43,     // nicname
53,     // domain
69,     // tftp
77,     // priv-rjs
79,     // finger
87,     // ttylink
95,     // supdup
101,    // hostriame
102,    // iso-tsap
103,    // gppitnp
104,    // acr-nema
109,    // pop2
110,    // pop3
111,    // sunrpc
113,    // auth
115,    // sftp
117,    // uucp-path
119,    // nntp
123,    // NTP
135,    // loc-srv /epmap
137,    // netbios
139,    // netbios
143,    // imap2
161,    // snmp
179,    // BGP
389,    // ldap
427,    // SLP (Also used by Apple Filing Protocol)
465,    // smtp+ssl
512,    // print / exec
513,    // login
514,    // shell
515,    // printer
526,    // tempo
530,    // courier
531,    // chat
532,    // netnews
540,    // uucp
548,    // AFP (Apple Filing Protocol)
554,    // rtsp
556,    // remotefs
563,    // nntp+ssl
587,    // smtp (rfc6409)
601,    // syslog-conn (rfc3195)
636,    // ldap+ssl
993,    // ldap+ssl
995,    // pop3+ssl
1719,   // h323gatestat
1720,   // h323hostcall
1723,   // pptp
2049,   // nfs
3659,   // apple-sasl / PasswordServer
4045,   // lockd
5060,   // sip
5061,   // sips
6000,   // X11
6566,   // sane-port
6665,   // Alternate IRC [Apple addition]
6666,   // Alternate IRC [Apple addition]
6667,   // Standard IRC [Apple addition]
6668,   // Alternate IRC [Apple addition]
6669,   // Alternate IRC [Apple addition]
6697,   // IRC + TLS
10080,  // Amanda
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

举报
请填写举报理由
0/200