Question: How to run apache on port 80, but only on specific IPs? (feature request?)

SupermanInNY

Verified User
Joined
Sep 28, 2004
Messages
419
Hello all,

We need to run a service that is listening on port 80.
Of course this is in conflict with Apache.

So we want to run apache such that it will listen only on specific IPs and ignore other IPs.
That way .. if I have another IP added to the server,. I can assign port 80 onto it and it will not be in conflict with the IPs loaded into Apache.

I would prefer to have this in the official IP Managment screen of the Admin with a checkbox that will "Use in DirectAdmin Web server1 (Apache)" so it will be available without special customization.

That way , the IP will always will be loaded onto the NIC like all DA IPs, but will not be used in the Web Server1 (which can be apache, nginx, litespeed etc).

This will enable the ability to run concurrent web servers - each with its own pool of IPs - so can have multiple environments and you can assign the user to use the IP on Apache,, or move them to a different IP that is used in nginx or nginx_apache ot litespeed or.. "load the IP, but don't use with a web server" (this is useful for loading the IP to the NIC, but perhaps using a service that is used for other services, not necessarily a webserver).
 
you can change apache port different than 80 but browser cannot recognize because standart http port is 80 , so it wont opened in browser except you write url ending with port ex : domain.com:8080

maybe you can use 443 ssl port for your sites and port 80 used for another service.
 
Well. since this is a single IP/single domain, we ended up adding another interface with another IP.
Then, in /etc/httpd/conf/httpd.conf I've edited:
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Whereas I removed the # and provided the actual IP that is in use:

Listen 1.2.3.4

And ran:
service httpd restart

That resolved the issue for our current setup.
The other IP on the other network, is now available to the other service to be used on port 80/443 as the client will ask.
 
Back
Top