4

I have a Linux system that has two Ethernet ports, one GPRS modem interface and Wifi. How can I configure Apache to run on all or a subset of those interfaces? Wifi & GPRS modem IP addresses will prob. be dynamic, ethernet addresses fixed.

9

The Apache Listen directive handles that.

All interfaces:

Listen 80

Specific IP only:

Listen 192.0.2.1:80
3
  • How could I specify it to listen say only on the Wifi interface, where the address is assigned by DHCP? Is there any way to specify an inteface, e.g. "wlan0"? – fred basset May 26 '13 at 20:37
  • 1
    Those addresses are usually more static than you'd think. At least, as long as your host is perpetually online. In the worst case, write some shell script to check the output of ifconfig/ip for the interface you want and then stuff that into your apache config and restart. – dmourati May 26 '13 at 22:56
  • Another idea: listen on all and firewall ones you don't want connections on. – dmourati Sep 10 '20 at 2:53
3

By default apache will listen on all available interfaces

# cat /etc/httpd/conf/httpd.conf | grep ^Listen
Listen 80

So there is no need in any specific configuration at all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.