Configure port forwarding in Centos to forward port 80 requests to port 8080

Source: Internet
Author: User

Configure port forwarding in Centos to forward port 80 requests to port 8080

Apache is deployed in Linux. To ensure security, we use a non-root user to start the service. However, when binding a domain name, we cannot directly access port 80. As we all know, in unix, non-root users cannot listen to the port numbers below 1024, And the apache server cannot be bound to port 80. Therefore, we need to use the port forwarding mechanism in linux to forward all service requests to port 80 to port 8080.
Run the following command under the root account:

Iptables-t nat-a prerouting-p tcp -- dport 80-j REDIRECT -- to-port 8080

In addition, if the firewall is restarted, the command will become invalid. You can use the following command to save the rule to iptables.

Service iptables save

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.