You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Antonio Fernández Pérez <an...@fabergames.com> on 2012/01/31 19:02:04 UTC

[users@httpd] Disabling virtual hosts in Apache

Hi everybody,

I would like to know how can I do to disable a virtual host and print an
error page in virtual host not enabled. Having www.mydomain.com and
www.mydomain2.com, when I execute a2dissite www.mydomain.com I get
www.domain2.com (its contents) and if I execute a2dissite
www.mydomain2.comI get
www.domain.com (its contents).

Please, can you tell me how can I do this? I would like to get to manage
virtual hosts with different domains and to have the possibility to disable
some virtual host, but having enabled another virtual hosts.

Thanks for your help.

Cheers!

-- 

*Antonio Manuel Fernández Pérez*

Ingeniero Técnico Informático

Dpto. Informático Fabergames S.L.

TLF:966261111 / FAX:966551801

www.fabergames.com
Fabergames respeta su
privacidad<http://www.fabergames.com/index.php/component/content/article/57/1-politica-de-privacidad>

* * * ADVERTENCIA LEGAL * * *

Le informamos, como destinatario de este mensaje, que el correo electrónico
y las comunicaciones por medio de Internet no permiten asegurar ni
garantizar la confidencialidad de los mensajes transmitidos, así como
tampoco su integridad o su correcta recepción, por lo que FABERGAMES S.L.
no asume responsabilidad alguna por tales circunstancias. Si no consintiese
en la utilización del correo electrónico o de las comunicaciones vía
Internet le rogamos nos lo comunique y ponga en nuestro conocimiento de
manera inmediata. Este mensaje va dirigido, de manera exclusiva, a su
destinatario y contiene información confidencial y sujeta al secreto
profesional, cuya divulgación no está permitida por la ley. En caso de
haber recibido este mensaje por error, le rogamos que, de forma inmediata,
nos lo comunique mediante correo electrónico remitido a nuestra atención o
a través del teléfono (+ 34) 966 26 11 11 y proceda a su eliminación, así
como a la de cualquier documento adjunto al mismo. Asimismo, le comunicamos
que la distribución, copia o utilización de este mensaje, o de cualquier
documento adjunto al mismo, cualquiera que fuera su finalidad, están
prohibidas por la ley.

Re: [users@httpd] Disabling virtual hosts in Apache

Posted by Yehuda Katz <ye...@ymkatz.net>.
2012/1/31 Antonio Fernández Pérez <an...@fabergames.com>

> Hi everybody,
>
> I would like to know how can I do to disable a virtual host and print an
> error page in virtual host not enabled. Having www.mydomain.com and
> www.mydomain2.com, when I execute a2dissite www.mydomain.com I get
> www.domain2.com (its contents) and if I execute a2dissite
> www.mydomain2.com I get www.domain.com (its contents).
>
> Please, can you tell me how can I do this? I would like to get to manage
> virtual hosts with different domains and to have the possibility to disable
> some virtual host, but having enabled another virtual hosts.
>

The a2dissite/a2ensite tools are part of the Debian-customized distribution
of Apache. The tool actually removes the vhost configuration from the files
included in the server's configuration. Apache does not even know that a
disabled site exists.

Here is my suggestion. Create a new vhost config with the filename starting
with 000 (or enable the included default vhost).
Set that vhost to show an "Site Disabled" error no matter what the request
is.
Now when you disable a site using a2dissite, you will get the error message
from the default vhost.

- Y