8080-port to 80-port forwarding under Mac

Source: Internet
Author: User

MAC OS is essentially a UNIX system, and UNIX systems are mostly non-root users that are not able to use a common port less than 1024 by default. At this time if you need to use 80 ports in your development, such as Tomcat, for example, Vitualbox An HTTP service has been built and you need to do some system port forwarding if you want to access it directly from the browser's localhost (without the ": Port").

MAC OS 10.10 on pfctl can do this thing, for details, see

1. Create File:

sudo vim/etc/pf.anchors/eclipse.tomcat.forwarding

File contents:

127.0. 0.1  the 127.0. 0.1 8080  127.0. 0.1 443 127.0. 0.1 8443

2. Create file:

sudo vim/etc/pf-tomcat.conf

File contents:

" forwarding " Load " forwarding " " /etc/pf.anchors/eclipse.tomcat.forwarding "
3. Start
sudo pfctl-ef/etc/pf-tomcat.conf
Execution results
sudo pfctl-ef/etc/pf-   tomcat.conf   -f option, could result in flushing of rulespresent in the main ruleset added by the system at startup. See/etc/pf.conf for further details. No ALTQ support in KERNELALTQ related functions DISABLEDPF enabled
Assuming your project http://localhost/myDemo.html this time to access your Web project, you will find that http://localhost/myDemo.html this does not require a 8080 port to access, plus/HTTP Localhost:8080/mydemo.html can't access it. 4. Close
sudo pfctl-d
Execution results
sudo pfctl-   d   In KERNELALTQ related functions DISABLEDPF disabled
When you visit your Web project, you will find that http://localhost/myDemo.html cannot access it, plus http://localhost:8080/myDemo.html can access it. or close all
Pfctl-f all-f/etc/pf.conf

8080-port to 80-port forwarding under Mac

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.