How to carry out port forwarding under Mac for a series of debugging tasks that require the use of port 80

Source: Internet
Author: User

  Described in the previous article, You can add a record in the local hosts file to resolve the local 127.0.0.1 of the trusted domain name in the public number, but Tomcat does not start on the non-root 80 port of the Mac, so we can use Pfctl port forwarding to forward the request on the local 80 port to port 8080, for example, by 80-port access.

Note: Mac OS uses port 80 for network file sharing and needs to be shut down first.

I. Modification of/ETC/PF.CONF

The pf.conf is backed up first: Cp/etc/pf.conf/etc/pf.conf.normal.bak, followed by the following line in the file:

" com.apple/* "

Add a line of configuration later, as follows:

127.0. 0.1  the 127.0. 0.1 8080

PS: Lo0 through ifconfig see oneself that device binds is 127.0.0.1, Lo0 is the name of this network device

Second, execute the following command in turn:

sudo pfctl-dsudo pfctl-f/etc/pf.conf  sudo pfctl-e  

Note in particular: If you have a server such as Apache that occupies 80 ports, you need to stop it to succeed!

This port forwarding configuration is successful, the next one will explain how to turn port forwarding on and off into two script files, each time sudo runs the two scripts can be easily turned on and off.

Fullstack.yang

2016-12-26 Tianfu Software Park in Chengdu High-tech Zone

How to carry out port forwarding under Mac for a series of debugging tasks that require the use of port 80

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.