gpt4 book ai didi

使用 iptables 将端口 443 (https) 重定向到 IP

转载 作者:行者123 更新时间:2023-12-02 19:15:10 25 4
gpt4 key购买 nike

我已经尝试了几个小时来完成这项简单的工作,但它并不像您想象的那么简单。

我想将 443 和 80 端口的每个请求重定向到网络服务器,在我的示例中 http://127.0.0.1:80

端口 80 工作没有任何问题,但 443 端口尝试了我很多时间......

我猜您已经尝试过运行以下命令:

iptables -t nat -A OUTPUT -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:80

但是这是错误的,因为端口 443 无法重定向到 443 以外的其他端口。

最佳答案

解决方案是:

使用以下命令:

iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination 127.0.0.1:443

然后为 apache 启用 https。

如果您使用 CentOS,请使用本教程 - http://wiki.centos.org/HowTos/Https

祝你好运。

关于使用 iptables 将端口 443 (https) 重定向到 IP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22475638/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com