Why do I need a Default Apache Server listening on Any IP on Any Port?

11 posts / 0 new
Last post
#1 Sun, 10/27/2013 - 01:13
eddieb

Why do I need a Default Apache Server listening on Any IP on Any Port?

Why is this needed?

Default Server Any Any Automatic /var/www/html

I don't have any content in /var/www/html that I ever want to serve.

Thanks

Sun, 10/27/2013 - 23:54
andreychek

Howdy,

You shouldn't need a default server listening on any IP/Port. In fact, having one would likely cause problems.

Are you having problems of some sort? If so, can you describe them?

-Eric

Sat, 11/23/2013 - 13:32 (Reply to #2)
eddieb

You could say I am having problems, I could not install a SSL cert via virtualmin, only manually. https://www.virtualmin.com/node/30756

I dont know if that is related to the issue referenced in this post I can't even delete this default server:

Tue, 10/29/2013 - 20:14 (Reply to #3)
eddieb

any word of advice, andrey?

Tue, 10/29/2013 - 22:24
andreychek

Well, you seem to be seeing some unusual issues, and I unfortunately don't seem to be able to reproduce any of them.

Your issues with SSL shouldn't be related to having a virtual host listening on any port though.

That just means that there's a "VirtualHost" entry in your Apache config that contains a "*:80", meaning that it's set to listen for all IP addresses.

Virtualmin wouldn't have set that up -- you may need to manually remove that entry from your Apache config if you wish to get rid of it.

It'd be no problem to remove that though (or to comment it out) -- and once you do, just restart Apache afterwards.

-Eric

Wed, 10/30/2013 - 16:50
eddieb

I changed the beginning of the conf from http://ideone.com/H7yYnR to http://ideone.com/qdzTJw and restarted apache. I still had a default server listening on Any:Any.

(after the snips above, the containers began, and NONE had asterisks before or after the colon)

please advise.

Sat, 11/23/2013 - 14:03
andreychek

As I review my various Virtualmin systems, they all show what you're describing in Webmin -> Services -> Apache -- in there they all show that Apache is listening on "Any" IP and "Any" port.

That doesn't cause any interference with how the server works, especially after setting a preferred Virtual Server as the default (which can be done in Server Configuration -> Website Options).

You mentioned that you were having a problem setting up Varnish -- what problem are you having exactly?

-Eric

Sat, 11/23/2013 - 22:37 (Reply to #7)
eddieb

I was going by what you said earlier "You shouldn't need a default server listening on any IP/Port. In fact, having one would likely cause problems."

Varnish should be the only one listening on 80. If I have a default server listening on any IP/Port, it (might) be also listening on 80, which is a problem for Varnish. I followed the instructions at http://badlywired.com/technical-stuff/2013/09/27/setting-up-varnish-with...

I get from apachectl -t: NameVirtualHost x.x.x.x:80 has no VirtualHosts 3 times, for the IPs ending in 197, 195 and 35. I used the supplied script. I could also do a search and replace on httpd.conf to try to avoid this, but the article specifically mentions not to manipulate httpd.conf outside of Virtualmin.

Besides the conf error, all sites stopped working. I reverted quickly to the default setup (it's a production server)

Thanks

Sun, 11/24/2013 - 22:15
andreychek

My apologies, I mis-understood the context of what you were describing.

You should not have a VirtualHost block containing Any IP/Port.

We run into a lot of folks who end up with one of those, for one reason or another, and they do cause problems.

However, the default Apache config you're describing there is normal.

If you change the port that Apache is running on, you would also need to update the port listed in your various VirtualHost blocks in your Apache config, as well as the port listed in that "NameVirtualHost" line that's generating the warning that you're seeing.

-Eric

Mon, 11/25/2013 - 01:13 (Reply to #9)
eddieb

Thanks. How do I remove that any/any vhost from virtualmin and apache?

Mon, 11/25/2013 - 08:29
andreychek

Well, you don't actually have a VirtualHost with any/any, you're just seeing a standard Apache configuration.

That is, when you see that in Webmin, Webmin is just telling you that Apache is listening for incoming connections on 0.0.0.0, on whatever ports are defined in there.

That's the correct setup.

If you had a VirtualHost that was defined like this, this would be a problem:

<VirtualHost *:80>

That's not the case though -- your setup is correct.

To add Varnish into your setup, you would need to make sure you update all the references in Apache to port 80, to whatever other port Apache is listening on.

Also, you'd need to make sure that Varnish is accessing your domains using the IP address they're configured with.

If you have a domain "example.com", and Apache is configured to listen for that on IP x.x.x.x (typically the eth0 interface, or your public IP address) -- if Varnish attempted to access IP 127.0.0.1, that wouldn't work, as Apache isn't looking for "example.com" to be on 127.0.0.1.

-Eric

Topic locked