maybe OT? apache configuration

E K ekg_ab-FFYn/CNdgSA at public.gmane.org
Mon Oct 25 18:16:40 UTC 2010


--- On Mon, 10/25/10, Matt Price <moptop99-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:

From: Matt Price <moptop99-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
Subject: Re: [TLUG]: maybe OT? apache configuration
To: tlug-lxSQFCZeNF4 at public.gmane.org
Received: Monday, October 25, 2010, 10:49 AM



On Sun, Oct 24, 2010 at 7:49 PM, Jamon Camisso <jamon.camisso at utoronto.ca> 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.   


Try enabling followSymLinks in the <Directory> directive because that is what you are actually doing. I am assuming that you Apache is able to list and read the Drupal directories and that php is not restricted from executing scripts in any directories. 

I have this feeling you are just around the corner with this. Check also if php is restricted to executing scripts to the Wordpress directory tree only as a security measure.

>

> 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.  
 
<VirtualHost> takes ip address or FQDN. Where did you put the <VirtualHost tdhc.digitalcommons.ca:80> stanza? It should come before the default virtual host stanza.


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

Like most sysadmin problems it is easy once you solve it.

Regards,
Equbay (EK)


>Thanks again,
>Matt
 




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