S
S
Stalker_RED2011-01-28 01:58:37
Apache HTTP Server
Stalker_RED, 2011-01-28 01:58:37

How to make Apache listen on a specific interface with DHCP?

There is a machine with Apache under win7.
If you specify in httpd.conf Listen *:80then Apache listens on port 80 on all interfaces it finds. If you specify a specific IP address, Listen 209.85.349.147:80then it listens only to the desired interface, leaving the rest free (and I need it periodically).
The problem is that this IP is issued via DHCP, and rewriting httpd.conf every time is somehow not comme il faut.
Listen 127.0.0.1:80- not an option, because sometimes you need to open some virtual hosts for viewing from the outside.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vlad Zhivotnev, 2011-01-28
@inkvizitor68sl

Well, they just told me - habrahabr.ru/blogs/webdev/112193/
Add the script to rc.local, restart the network and rejoice.

Z
z0rc, 2011-01-28
@z0rc

scnr.net/blog/index.php/archives/65 Good
for *nix. I'm not sure that the Windows firewall can do this.

P
Puma Thailand, 2011-01-29
@opium

Attribute listen to domain.ru:80

M
mitnlag, 2011-01-29
@mitnlag

Yes, I don’t see any problems :-)
Break the config into two parts - before Listen and after.
Make a batch file.
I'll write the idea, specify the syntax yourself.
from ipconfig get the current ip on the interface.
further
type preconfig > httpd.conf
echo "Listen $IP:80" >> httpd.conf
type postconfig >> httpd.conf
There are many ways, they revolve around the template and the modifier.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question