0

I want to create a Drupal Multisite so I can share my theme and users between two sites. I want to set it up locally before I upload it on a webhost.

I am using Mac 10.10. However, many of the tutorials seem to be written for older versions of Mac OSX and don't work properly.

For example, this tutorial suggests the following:

Edit /etc/apache2/http.conf to add the following:

NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot /Users/YOURSITE/Sites/drupal
ServerName drupal1.localhost
</VirtualHost>


<VirtualHost 127.0.0.1:80>
DocumentRoot /Users/YOURSITE/Sites/drupal
ServerName drupal2.localhost
</VirtualHost>

Then edit /etc/hosts to add the following:

127.0.0.1     drupal1.localhost
127.0.0.1     drupal2.localhost

You can now find your site at: http://drupal1.localhost & http://drupal2.localhost

When I do this, I just get the message "It Works" I am unable to go to the Druapl installation page to start installing the site.

I've had a search for other tutorials, but they all seem to be written for MAMP.

How can I fix it, without using MAMP?

11
  • Did you restart apache after making changes to http.conf? Commented Mar 7, 2015 at 17:54
  • @PatrickRyan. Yes, I did "sudo apachectl restart"
    – big_smile
    Commented Mar 7, 2015 at 17:56
  • Did you edit the DocumentRoot and the <Directory "/some/default/path"></directory> to point to your Drupal installation? I'm referring to the DocRoot and Directory outside of your Vhost Commented Mar 7, 2015 at 18:20
  • @PatrickRyan Which file would I edit that in. Is it located in /etc/. I am quite new to this, so I'm not sure which file path to look in. Thanks!
    – big_smile
    Commented Mar 7, 2015 at 18:36
  • It should be in the same file, http.conf Commented Mar 7, 2015 at 18:59

1 Answer 1

2

It sounds like you don't have your directories configured properly.

Assuming that you have this file structure:

/users/
    /drupal/
        /sites/
            /drupal1.localhost/
                /settings.php
            /drupal2.localhost/
                /settings.php

Note that the folders under /sites must match the http.conf server name. (unless alias's are set up).

With the above structure, your http.conf would look like this:

DocumentRoot "/users/drupal"

<Directory "/users/drupal">
    AllowOverride All
</directory>

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    DocumentRoot "/users/drupal"
    ServerName drupal1.localhost
    <Directory "/users/drupal">
        Require all granted
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:80>
    DocumentRoot "/users/drupal"
    ServerName drupal2.localhost
    <Directory "/users/drupal">
        Require all granted
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Note that the document root points to the base Drupal folder, not /sites. Drupal will handle this part automatically.

Your hosts file would remain the same:

127.0.0.1     drupal1.localhost
127.0.0.1     drupal2.localhost

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.