By Olwe on
I found this: http://drupal.org/node/290768
But is this what I need to follow? I've got D6.16 installed and running on my Ubuntu10.04 from an apt-get install (base dir is /usr/share/drupal6/...). What I want is to be able to work on/develop multiple practice sites on my home (non-live) computer. For normal multiple website practice I've already got a public_html directory, plus a couple symlinks in /var/www/ to my home dir, but I'm sure that's not right for multiple Drupal sites....
Comments
.
Why not? They are complete Drupal sites, with their own database, administrator, available and enabled modules and themes, everything.
I'm still confused. I went to
I'm still confused. I went to "10 Minute Multisite Install & Configuration" (http://drupal.org/node/138889#comment-2510252) and it says:
I'm on a home computer (Ubuntu 10.04) with LAMP installed properly, drupal6 apt-got, database setup fine ... but I don't know anything about http://www.example.com. My local Apache2 webserver goes to http://localhost or http://127.0.0.1 How can I make a browser see drupal at http://www.example.com? I'd like that, then I'd like to have other sites on my home machine, such as http://another_drupal_site_1.com, http://another_drupal_site_2.com, etc. I've seen various install/config guides, but they all seem to bypass this basic issue.
.
To use domain names like http://example.com locally on your computer for vhosts which you have set up, you can edit your /etc/hosts file and add, for example:
But better don't do that because it may be confusing later when you try to access an online site and you get a local one. Instead of that, you can use domains like
Those names are the ones supposed to be used in the examples in that guide, in ServerName:
So I should create a file
So I should create a file called drupal in /etc/apache2/sites-available/ and it should be based on the example ...
So what is the ServerName supposed to be? Let's say I want to work on 3 separate sites at home. You're saying call them something1.local, something2.local, and something3.local in this file. What about the ServerAlias? Is that just for leaving off www.? What should the DocumentRoot be? I understand I need to create separate directories in /usr/share/drupal6/sites right? How will this know that something1.local means "go use the stuff in .../drupal6/sites/something1/ ? And I guess I should also let /etc/hosts know about something1.local, something2.local and something3.local like 127.0.0.1 something1.local
Very confusing!
.
In the server configuration part, there are no separate subdirectories for your different Drupal sites. Just different domain names, which all point to the same directory where Drupal's index.php file is.
DocumentRoot specifies the disk directory where you want your vhost to look. In this case it will always be
for all Drupal sites, since that is where Drupal's index.php file is located.
ServerName is the domain name of your site. For a site at http://example1.local you would use
ServerAlias can be used for alternative domain names served by the same vhost. Using that, you can make this one vhost serve all your Drupal sites, so that you don't have to create more vhosts:
and you are done. No more vhosts with their own ServerNames are needed, which is a reasonable thing to do because they all use the same DocumentRoot (drupal).
---------
That was the server part. Now, how Drupal will tell apart the sites based on the browser's request, and where it will store each site's stuff, that is what the link in your first post explains.
--------- EDIT:
Oops. No, wait. There has been a mix-up here. The first article is about installing Drupal "in the normal way", by uploading it from drupal.org. The second one is about using the Ubuntu installer, which splits and stores Drupal in many different places. The principles are the same but the paths are different. In a "normal" install, your document root would be /var/www/drupal or wherever you uploaded drupal.
So this is what I've done so
So this is what I've done so far: I've got a file in /etc/apache2/sites-enabled/ called drupal
I've left the ServerAlias commented because I'm not worried about www.practice1.local and practice1.local resolution. I did the apache reload. I then created directories /usr/share/drupal6/sites/practice1.local and /usr/share/drupal6/sites/practice2.local and copied the contents of .../sites/default/ into them.
Now comes the critical part: 1) What do I do with /etc/hosts? I've tried various things that don't work; when I go to http://practice1.local or http://practice2.local nothing happens, the browser just sits there. (I guess that's sort of good because it's not going out on the Web and looking.) I can map 127.0.0.1 (or any 127.0.x.x) to a practice3.local in /etc/hosts (without apache sites-enabled stuff for practice3.local) and it takes me to the default apache webserver page just fine. So what should /etc/hosts have now? And 2) how does any of this know about my new directories .../sites/practice1.local and .../sites/practice2.local?
Very frustrating. Lots of conflicting advice and info. For example: http://drupal.org/node/278 has a vague reference to apache tweaking. The CPanel version is totally useless. I have not changed the settings.php files in the new sites' directories, because the 10-Minute Guide says it's not necessary, while the Multi-Site on Linux says do it. Even in the 10-Minute Guide the first guide and the "manual guide" conflict on what to do with Apache.
.
Assuming that Drupal is really installed in /usr/share/drupal6
Never write in /etc/apache2/sites-enabled
In /etc/apache2/sites-available:
Enable this vhost file:
To make your machine recognize the domain names, edit /etc/hosts:
Restart apache
You are done with the server.
Now, how can Drupal tell the sites apart: All sites hit Drupal's index.php file. Drupal wakes up and reads the HTTP_HOST from the URL which you typed in your browser to get there. It compares it with the names of the directories under sites/. If it finds a match, it brings up the right site. If not, it uses sites/default.
Make sure that the settings.php files which you copied under sites/sitename/ are fresh unmodified copies of default.settings.php. Then, browsing to any site should bring up Drupal's installer for that site.
Two errors come up after I
Two errors come up after I change .../sites-available/drupal:
# /etc/init.d/apache2 reload
Syntax error on line 11 of /etc/apache2/sites-enabled/drupal:
AllowOverride not allowed here
...fail!
I comment it out and it gives this error (the old error:
/etc/init.d/apache2 reload
* Reloading web server config apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
/etc/hosts are as you advise.
.
AllowOverride belongs inside a Directory section:
About "Could not reliably determine", it usually means that you haven't set the ServerName line or maybe there is a spelling error in "ServerName".
-------- Edit:
Also, unlike what that guide says, DocumentRoot and that Directory are normally /var/www/drupal6
Good. Made the change to the
Good. Made the change to the .../sites-available/drupal file:
I do the # /etc/init.d/apache2 reload
and get the same error:
* Reloading web server config apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
There are no misspellings. I can remove the drupal symlink in .../sites-enabled, redo apache2 reload and get the same error. Put the symlink back in with a2ensite, same error.
Meanwhile in my browser http://practice1.local just brings up a white page. http://practice1.local/drupal6/install.php just sits there white page. Curiously, If I change /etc/hosts to 127.0.1.1 practice1.local and 127.0.1.1 practice2.local, the browser at http://practice1.local goes to the apache default page (It works!...), but http://practice2.local goes to blank white page. Then back to http://practice1.local/drupal6/install.php -- blank, white page! Switch /etc/hosts back to 127.0.0.1 for both practice1.local and practice2.local and the error comes back!
Here's my /etc/hosts:
The reload seems to complain about ServerName with or without the .../sites-available/drupal symlink, but if /etc/hosts is changed (127.0.1.1 instead of 127.0.0.1 for practice1.local ...) the ServerName complaint goes away! How can that be?
Could this be an Ubuntu-Debian package issue? I had the same craziness with a language and Emacs major-mode fight; the language I hand-installed, the major-mode I apt-got -- and I finally had to go totally hand-installed for both.
Sorry for all the confusion....
.
Then 127.0.1.1 may be the right one for your system. It depends.
About ServerName, does it change anything if you move up ServerName and ServerAlias and place them next to DocumentRoot, and not after all those other directives?
No, moving didn't help. But
No, moving didn't help. But then 127.0.1.1 in /etc/hosts for practice1 and 2 only gives me regular http://localhost/ behavior (goes straight to "It works!" screen) and can't even see .../drupal6/install.php, AND practice2/ doesn't even do It works! But then http://localhost/drupal6/install.php does work. Very weird. Anyway, I've asked a LUG for assistance. The ACLUG is a bunch of old debian sys admins. If they don't know how to manage this unruly Ubuntu behavior, it's hopeless....
.
What about
Same old same old. BTW, it
Same old same old. BTW, it doesn't like the space between allow,deny for Order.
do you use linux for everyday
do you use linux for everyday tasks or only for the drupal? if for the latter one only, then i would suggest to run linux on a vm, and then using winscp to handle all the drupal files etc... i personally use windows as os, but all my drupal sites run on a single vm using LAMP and no prob so far
I'm exclusively on Linux
I'm exclusively on Linux Ubuntu 10.04. Maybe I should bail to Win7 if this can't be done on Linux before insanity rears its ugly head....