Answer the question
In order to leave comments, you need to log in
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 *:80
then Apache listens on port 80 on all interfaces it finds. If you specify a specific IP address, Listen 209.85.349.147:80
then 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
Well, they just told me - habrahabr.ru/blogs/webdev/112193/
Add the script to rc.local, restart the network and rejoice.
scnr.net/blog/index.php/archives/65 Good
for *nix. I'm not sure that the Windows firewall can do this.
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 questionAsk a Question
731 491 924 answers to any question