Virtual server doesn't work without IP added to <VirtualHost>

2 posts / 0 new
Last post
#1 Fri, 02/17/2017 - 08:02
rolandow

Virtual server doesn't work without IP added to <VirtualHost>

I'm not sure if this belong in the Virtualmin forum, it might as well be in the Webmin forum.

My problem is that when I create a new virtual server, the web server doesn't respond to requests. When I manually edit the virtualhost config and add the external IP to the VirtualHost directive, it works. I keep forgetting this, so I'd like to finally solve this little issue.

I think it might have to do with the configuration of the network of the server, because this is how it looks like:

root@web:~# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:23719234 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23719234 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7088484625 (7.0 GB)  TX bytes:7088484625 (7.0 GB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:127.0.0.2  P-t-P:127.0.0.2  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: 2a...28 Scope:Global
                     ----8<--- more ipv6, cut ------>8-----
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:290521047 errors:0 dropped:0 overruns:0 frame:0
          TX packets:334080304 errors:0 dropped:2 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:123258264808 (123.2 GB)  TX bytes:246640703055 (246.6 GB)

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:5.1.99.999  P-t-P:5.1.90.104  Bcast:5.1.90.104  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

So vnet0:0 had my public ip (which I changed in this example).

In my virtualmin, 127.0.0.2 keeps coming back though, so maybe this is an issue.

Also I'm not sure if the IP should be added to the virtualhost directive, if I want to use let's encrypt?

So an other solution would be to change the template which is generated when I create a new virtual server. I can't seem to find where I should do this though, and I feel this is most likely not the right path to take.

Fri, 02/17/2017 - 08:07
rolandow

Nevermind, as usually I found it after asking on a forum. It's in Webmin -> Servers -> Apache webserver -> Global configuration tab -> Networking and addresses. Sorry I bothered you!

Topic locked