Skip to content
Advertisement

Having Apache httpd listen on port 80, but not started as root?

I would like to have my Apache httpd launch as non-route user (httpd) and still listen on port 80/443. This server will be running on a Linux host.

Given that the first 1024 ports are reserved, how would I go about having a reserved port handled by a non-root daemon? Alternatively, can I run my apache on a non-reserved port and have the port’s traffic redirect locally to that other port?

Advertisement

Answer

You can use iptables for port redirecting:

# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement