Chrome:ERR_UNSAFE_PORT

Chrome:ERR_UNSAFE_PORT


1.背景

搭建nginx web服务,无意中设置监听端口6666,出现如下错误:

在这里插入图片描述
报错:ERR_UNSAFE_PORT。


2.环境

Chrome:

在这里插入图片描述

nginx:

$ nginx -v
nginx version: nginx/1.16.1

nginx.conf:

server {
    listen       6666;
    location / {
        root   /home/test1280/test1280-gitbook/_book/;
        index  index.html;
    }
}

3.解决

curl访问6666端口,成功:

$ curl -I http://127.0.0.1:6666/
HTTP/1.1 200 OK
Server: test1280
Date: Wed, 21 Jul 2021 10:41:13 GMT
Content-Type: text/html
Content-Length: 10964
Last-Modified: Wed, 21 Jul 2021 09:38:54 GMT
Connection: keep-alive
ETag: "60f7eb2e-2ad4"
Accept-Ranges: bytes

Chrome访问6666端口,失败:ERR_UNSAFE_PORT。

Chrome打开调试F12:

在这里插入图片描述
注意,报错信息是ERR_UNSAFE_PORT,不安全端口。

经查,是Chrome自身限制,访问某些受限的端口将报错ERR_UNSAFE_PORT。

参考:

https://superuser.com/questions/188006/how-to-fix-err-unsafe-port-error-on-chrome-when-browsing-to-unsafe-ports

附表:Chrome unsafe port

  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
  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
  139,  // netbios
  143,  // imap2
  179,  // BGP
  389,  // ldap
  465,  // smtp+ssl
  512,  // print / exec
  513,  // login
  514,  // shell
  515,  // printer
  526,  // tempo
  530,  // courier
  531,  // chat
  532,  // netnews
  540,  // uucp
  556,  // remotefs
  563,  // nntp+ssl
  587,  // stmp?
  601,  // ??
  636,  // ldap+ssl
  993,  // ldap+ssl
  995,  // pop3+ssl
  2049, // nfs
  3659, // apple-sasl / PasswordServer
  4045, // lockd
  6000, // X11
  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]

解决办法:

1.修改后端服务(nginx)监听端口,使用任意不在上述列表中的端口

2.修改Chrome启动参数、配置(请自行查找)

我直接修改端口改成8090,访问成功:

server {
    listen       8090;
    location / {
        root   /home/test1280/test1280-gitbook/_book/;
        index  index.html;
    }
}
$ nginx -s reload

在这里插入图片描述


4.参考

1.https://superuser.com/questions/188006/how-to-fix-err-unsafe-port-error-on-chrome-when-browsing-to-unsafe-ports
2.https://thegeekpage.com/err-unsafe-port/
3.https://blog.csdn.net/testcs_dn/article/details/39186225
4.https://blog.csdn.net/dongzibin/article/details/80779089

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值