I want to configure Apache2 (on Ubuntu 14.04) such that it starts on boot and listens on 127.0.0.1:80 and 192.150.0.1:80.
For this, I have the following lines in /etc/apache2/ports.conf
:
Listen 127.0.0.1:80
Listen 192.168.150.1:80
and the VirtualHost directive's start tag:
<VirtualHost 127.0.0.1:80 192.168.150.1:80>
Things worked fine after these edits and running sudo apache2ctl restart
.
But the latter IP is not bound to an active interface on the server at startup, so Apache could not start at next boot.
I found it here:
When trying to bind to an IP and port not present on the host system, apache httpd will fail to start.
I want apache to not kill itself if failing to bind on the latter IP is all that has went wrong. Is there any solution using Apache Configuration Directives that:
- starts Apache successfully at boot even if the second address is not bound to any interface.
- requires me to only switch on the interface and restart apache to listen on both addresses.
?
I do not want to manually edit /etc/apache2/ports.conf
every time after switching on the interface.