maybe OT? apache configuration

Jamon Camisso jamon.camisso-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Sun Oct 24 23:49:13 UTC 2010


On 10/24/2010 07:07 PM, E K wrote:
> Hi Matt,
> 
> I don't fully understand the function of the serverName in the <VirtualHost ......> stanza. The only time I specify it is in a secure website specification. 
> 
> When I configure virtual hosts I have some thing like
>      <VirtualHost virtualhostname:port>
>         virtual domain configuration stuff goes here
>      </VirtualHost>
> 
> The stanza
>     <VirtualHost *:80>
>         .......
>    </VirtualHost>
> is for the default website that is not configured with any of the <VirtualHost> ....</VirtualHost> stanzas above it. Anything under it is just redundant which will never be accessed (well, with port 80, to be exact).
> 
> Long story short, one solution you might try is to create a symbolic link to your
>     /home/drupal-commons/drupal_commons at /var/www/ with
> 
> ln -s /home/drupal-commons/drupal_commons /var/www/drupalsitename
> 
> and let the drupal site be accessed like the other Wordpress sites.
> 
> If your drupal site requires different configuration setting than the word press ones, then this will not work. You have to have a drupal virtual host stanza with 
> 
>     <VirtualHost  drupalsite:80>
>         configuration stuff
>     </VirtualHost>
> stanza above the default <VirtualHost *:80> stanza which happened to serve the WordPress sites.
> 
> HTH,

Lots of different ways to do virtual hosts in Apache.
<Virtualhost *:80> is pretty common with ServerName and ServerAlias
directives.

Something like this would work:

<VirtualHost *:80>
    ServerName drupal.example.com
    DocumentRoot /home/drupal-commons-etc
</VirtualHost>

<VirtualHost *:80>
    ServerName example.com
    ServerAlias *.example.com
</VirtualHost>

Otherwise, mod_rewrite could be used based on matching HTTP_HOST and
redirecting accordingly.

tl;dr it doesn't hurt to be explicit with ServerName and ServerAlias
directives.

Jamon
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list