Linux – apache configuration for drupal multisite

apache-2.2drupallinuxUbuntu

I have spent over a day trying to get a multisite install to work and I think most of it is in place but I still cannot see the install.php when I visit www.mywebsite.co.uk/install.php?

I have a dedicated server running ubuntu, apache2 and latest mysql and php 5.

I have installed the latest Drupal codebase into

/home/d/r/drupal/web/public_html

I have have setup drupal database (called drupal) to and configured the codebase and all is working great and can view the drupal installation no problem on www.myserver.co.uk/drupal.

I next followed the instructions at: http://gotdrupal.com/videos/multisites-vs-multiple-sites and have setup up my apache conf almost exactly as described:

These are the contents of my various conf files:

/etc/apache2/conf.d/drupal6.conf:

#============================================================
# Toggle APC cache
#php_flag apc.cache_by_default 1
#This is already enabled in php

<Directory "/home/d/r/drupal/web/public_html">
    # Yeah, better performance - no hits to the file system
    # Loading Drupal's .htaccess into memory is much better
    AllowOverride none

    # Define your own file limitations on drupal files
    <FilesMatch "(install.php|cron.php|update.php|\.txt)$">
        Order deny,allow
#        Include conf.d/ip.conf
# including the line above always caused an error when re-starting apache2 so I have hard coded the IPs below (these are not the ones I am usinb obviously!)
Allow from 123.123.123.123
Allow from 124.124.124.124
        Deny from all
    </FilesMatch>

    # Read in Drupal default .htaccess file asif conf - easier CVS management
    Include /home/d/r/drupal/web/public_html/.htaccess

# Offline mode for multisite setup - see file for more info
# Uncomment the line below to set sites offline
    # Include conf.d/offline.conf

</Directory>

# Sorry, no svn peeking
<DirectoryMatch "\.svn">
    # Currently pointing back to drupal
    # High traffic sites might want custom
    # error pages, no need to load drupal
    ErrorDocument 403 /index.php
    Order allow,deny
    Deny from all
    Satisfy All
</DirectoryMatch>

# Allow the .htacces files to be used in the sites folder where /files are stored
<Directory "/home/d/r/drupal/web/public_html/sites">
    AllowOverride
</Directory>

# Block off access to admin and devel - just in case
<LocationMatch "/(admin|devel)">
    Order deny,allow
#    Include conf.d/ip.conf
# including the line above always caused an error when re-starting apache2 so I have hard coded the IPs below (these are not the ones I am usinb obviously!)
Allow from 123.123.123.123
Allow from 124.124.124.124
    Deny from all
</LocationMatch>
#============================================================

/etc/apache2/conf.d/ip.conf:

#============================================================
#This file always caused a problem when repstarting apache so I hard coded the IP addresses
# into the drupal6.conf file.  Would like to undersatand why this wont work! I am using the correct IP addresses, these are just for posting!
Allow from 123.123.123.123
Allow from 124.124.124.124
#============================================================

/etc/apache2/apache2.conf:

#============================================================
# ..
# ..
# All the apache config and at the very bottom is these lines:
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/[^.#]*
#============================================================

/etc/apache2/sites-available/drupalsites.conf:

#============================================================
# This is called from Apache2.conf
# Each vhost can be read in as its own file
Include vhosts/mywebsite.conf
#============================================================

/etc/apache2/vhosts/mywebsite.conf:

#============================================================
# This is called from /etc/apache2/sites-available/drupalsites.conf
<VirtualHost mywebsite.co.uk:80>
DocumentRoot /home/d/r/drupal/web/public_html
ServerName mywebsiteco.uk
ServerAlias www.mywebsiteco.uk
ErrorLog /var/log/apache2/sites/mywebsite.co.uk_error-log
CustomLog /var/log/apache2/sites/mywebsite.co.uk_access-log "combined"

# Rewrite the www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.mywebsite\.co.uk/?$ [NC]
RewriteRule ^(.*)$ http://mywebsite.co.uk$1 [L,R=301]

# Read in the drupal configuration
Include conf.d/drupal6.conf

# Block access while developing
#  Include conf.d/beta.conf

</VirtualHost>
#============================================================

/etc/hosts:

127.0.0.1 localhost server0
127.0.0.1 mywebsite.co.uk
123.123.123.123 myservername.co.uk

The website root I have created is at:

/home/m/y/mysite/web/public_html

I have replaced the physical public_html directory with a symlink to

/home/d/r/drupal/web/public_html

I can view the text files such as www.mysite.co.uk/INSTALL.txt but when I try to view any php page (such as install.php or the root) I always get the following error:
"Internal Server Error, this is an error with your script, check your error log for more information."

I am at a loss as to what I need to do next and would appreciate any help or advice.

Thank you

Best Answer

The config you have posted is vastly more complicated than it needs to be. I'm not quite sure why it's set up that way, but I did notice a few things that might make a difference.

First and foremost, in drupal6.conf all you should need is the following:

<Directory /home/d/r/drupal/web/public_html/>
    Options +FollowSymLinks
    AllowOverride All
    order allow,deny
    allow from all
</Directory>

The rest of the stuff is secondary and may be complicating (or causing) the problem. I'd recommend - especially for the initial install - to simplify the configs as much as possible. I run a lot of Drupal sites and I never mess with anything beyond pointing the mysite.conf to the Drupal directory and creating the (Drupal root)/sites/my.site.com directory and settings files.

I'd recommend ripping all the other stuff out of the drupal6.conf and seeing if it works for the install. Then add back in the access blocks on the /admin, install.php, etc. I don't recommend messing with the .htaccess files in the config file. Leave out the line including the .htaccess in the apache configs and just let .htaccess be picked up as it's designed to by apache.