maybe OT? apache configuration

Matt Price moptop99-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Oct 25 14:49:04 UTC 2010


On Sun, Oct 24, 2010 at 7:49 PM, Jamon Camisso <jamon.camisso-H217xnMUJC0sA/PxXw9srA at public.gmane.org>wrote:

> 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).
>

that's what i'd thought, but i was flailing around a bit...


> >
> > 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.
>

so, i tried this.  it doesn't seem to work -- I get a "Forbidden" page form
apache.   I can't for the life of me figure it out, as the softlink points
to the same place as this alias in my /etc/apache2/conf.d:

Alias /drupal-commons /home/drupal-commons/drupal_commons

i guess there's something i fundamentally don't understand about hte way
apache assigns permissions.


>
> > 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.
>

i thought that <VirtualHost> Took an IP address as an argument, e.g.,
<VirtualHost 192.168.1.1:80>
this seems confirmed by my experience, e.g. when I add this stana:

        <VirtualHost tdhc.digitalcommons.ca:80>
        DocumentRoot /home/drupal-commons/drupal_commons
        ServerName tdhc.digitalcommons.ca
        </VirtualHost>

it has no effect.


> 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>
>

yes, so this is what I had (see the original posting) but for some reason it
isn't working when the second (generic) stanza is dynamic.  This is what I
have for the second stanza:

      <VirtualHost *:80>
        UseCanonicalName    Off
        VirtualDocumentRoot /var/www/%0
        Options All
        # Store uploads in
/var/www/wp-uploads/$0

        RewriteEngine On
        RewriteRule ^/wp-uploads/(.*)$ /var/www/wp-uploads/%{HTTP_HOST}/$1

        </VirtualHost>


> Otherwise, mod_rewrite could be used based on matching HTTP_HOST and
> redirecting accordingly.
>
> Is this really easy?  How would I use it for the site root (which doesn't
really have any regexes to match on)?

Thanks again,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20101025/7b6ebf32/attachment.html>


More information about the Legacy mailing list