hostess icon indicating copy to clipboard operation
hostess copied to clipboard

Enhancement: create default VirtualHost

Open ivanoats opened this issue 14 years ago • 4 comments

In order to keep the host that is originally defined in the main httpd.conf alive, you have to define a VirtualHost with the same values for it first. (see http://httpd.apache.org/docs/2.0/vhosts/name-based.html - Main Host Goes Away box )

I'm feeling too lazy to write something that parses the original httpd.conf right now and creates it automatically, sorry. But perhaps worth mentioning in the README

ivanoats avatar Nov 12 '10 01:11 ivanoats

Just so that I understand, does this deal with the situation where you've got Apache configured but without any virtual hosts enabled?

chrisroos avatar Apr 15 '11 15:04 chrisroos

Yes, that's it. Thanks!

ivanoats avatar Apr 15 '11 16:04 ivanoats

Ah, OK. Given that this doesn't affect my use of the gem, and no-one else complains, I'm going to leave this for now. You should absolutely feel free to add support if you'd like it :-) I'll leave this issue open in case anyone else comes across it/requests it.

chrisroos avatar Apr 15 '11 17:04 chrisroos

Just to chime in here, this is also useful when you do have virtual hosts configured, but still want to access http://localhost/ directly.

changing the hostess httpd.conf block to the following would do the trick:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName _default_
</VirtualHost>
Include /etc/apache2/hostess_vhosts/*.conf

Without the default server name, requests to http://localhost/ would be forwarded to the first configured virtual host. This is probably not the behavior people want or expect.

(FYI, setting a default virtual host is what the Phusion Passenger prefpane does. I'd consider it a best practice)

nathos avatar Jul 06 '11 18:07 nathos