1 月 262021
 

iptables示例

sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443

firewalld示例

# allow incoming connections on port 80.
# You can also use --add-service=http instead of adding a port number
sudo firewall-cmd --add-port=80/tcp --permanent
sudo firewall-cmd --permanent \
--add-forward-port=port=80:proto=tcp:toaddr=127.0.0.1:toport=8080

# allow incoming connections on port 443.
# You can also use --add-service=https instead of adding a port number
sudo firewall-cmd --add-port=443/tcp --permanent
sudo firewall-cmd --permanent \
--add-forward-port=port=443:proto=tcp:toaddr=127.0.0.1:toport=8443
sudo firewall-cmd --reload

内容引用:

https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-iptables/

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)