How does a Linux non-root user use port 80 to start the program?

Source: Internet
Author: User
For non-root users in Linux, how does one use port 80 to start the program? by default, only root users can use ports lower than port 1024 in Linux. our tomcat, apache, for nginx and other programs, if you want to use common users to occupy port 80, java.net will be thrown. bindException :... for non-root users in Linux, how does one use port 80 to start the program? by default, only root users can use ports lower than port 1024 in Linux. our tomcat, apache, for nginx and other programs, if you want to use common users to occupy port 80, java.net will be thrown. bindException: Permission denied: 80 exception. There are two solutions for www.2cto.com: 1. use non-Port 80 to start the program, and then use iptables for port forwarding. Iptables-t nat-a prerouting-p tcp -- dport 80-j REDIRECT -- to-port 8080 can be directly executed by the root user! 2. assume that the program to be started is nginx, so this can also be achieved. At first, we checked the nginx permission Description: www.2cto.com-rwxr-xr-x 1 nginx dev 2408122 Sep 5 01 nginx. at this time, nginx cannot be started normally. First, modify the file owner to root: chown root nginx, and then add the s permission: chmod u + s nginx to view the permission description again: -rwsr-xr-x 1 root 2408122 Sep 5 nginx can be started.

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.