How to configure Apache to serve Drupal 6 Multisite configuration - apache

I am trying to setup Apache to serve a Drupal 6 multi-site configuration, but I cannot seem to get it properly set up.
In my httpd.conf:
DocumentRoot "/Users/kevinyoung/Sites/drupal"
<Directory "/Users/kevinyoung/Sites/drupal">
Options FollowSymLinks Multiviews Indexes
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
DirectoryIndex index.html index.php
In httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "/Users/kevinyoung/Sites/drupal"
ErrorLog "/private/var/log/apache2/error_log"
CustomLog "/private/var/log/apache2/access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerName drupal.local
ServerAlias *.drupal.local
DocumentRoot /Users/kevinyoung/Sites/drupal
ErrorLog "/private/var/log/apache2/error_log"
CustomLog "/private/var/log/apache2/access_log" common
</VirtualHost>
In /etc/hosts:
127.0.0.1 drupal.local
127.0.0.1 <site_name>.drupal.local
Navigating to http://localhost shows "It Works!".
Navigating to drupal.local takes me to the default site for my D6 multi-site setup.
Now lets say I have another site directory (site_A.drupal.local) as another site inside drupal/sites/. Now I go to site_A.drupal.local, but it still takes me to the default site. Why would this be happening?
Any ideas why I can't access any other site besides my default site in this Drupal 6 multi-site configuration?
I am running Apache 2.4 on Mac OSX 10.10 Yosemite with Drupal 6, mysql 5.1.73, and php 5.5.14.

Related

MAMP - Document root wont work properly

MAMP - Document root won't work properly It only display one of my other projects, even If I change the root directory to my current project it just displays the same project as before. I can't change it at all no matter what I do, I have reinstalled MAMP 4 and MAMP 3. No matter what I do there is the same problem? CAN ANYONE HELP!!
This not DocumentRoot issue it's Directory issue because of MAMP use Apache 2.2.32. Apache2.2 and Apache2.4 are different Vhost format. MAMP version history.
Apache 2.2 Vhost format:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
Apache 2.4 Vhost format:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
<Directory "/Applications/MAMP/Library/docs/dummy-host2.example.com">
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
Apache Vhost format reference.
If you use MAMP your issue will not solve. Try Apache 2.4. If you are Windows user then use XAMPP or WAMP. If you are Mac user then use XAMPP.

Apache VirtualHost not pointing to correct subdirectory

I am a newbie to apache and server setup. I am migrating several sites from GoDaddy to a DigitalOcean VPS droplet. I am moving my first site over (a Wordpress install) and am having some trouble with VirtualHost. Here is the configs:
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/html/domain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Heres the thing, I have a www alias set up in the domain name records, and www.domain.com points correctly to the site, but domain.com points to the root var/www/html, not the subdirectory where the site is. I've searched for far too long, but every tutorial and forum seems to provide the same code I currently have configured. What am I doing wrong? I want to make sure it all works correctly before I take the next step of installing an SSL, but I am spinning my wheels at the moment.
The correct way to set up a virtual host is:
<VirtualHost *:80>
ServerAdmin admin#domain.com
DocumentRoot /path/to/the/directory
DirectoryIndex index.html index.php
ServerName domain.com
ServerAlias www.domain.com
ErrorLog ${APACHE_LOG_DIR}/domain.com.error.log
CustomLog ${APACHE_LOG_DIR}/domain.com.access.log combined
<Directory /path/to/the/directory>
Options -Indexes
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

joomla admin in subdomain blank page

I am having trouble accessing the Joomla administrator page in a subdomain.
Here's what it's like, the site is http://test.com and the admin page must be http://admin.test.com
I am using a WAMP server with virtual host enabled.
here's my httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin admin#test.com
DocumentRoot "c:\wamp\www\test"
ServerName test.com
ServerAlias www.test.com
ErrorLog "C:\wamp\www\test\logs\error.log"
CustomLog "C:\wamp\www\test\logs\access.log" common
<Directory "c:/wamp/www/test">
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#test.com
DocumentRoot "C:\wamp\www\test\administrator"
ServerName admin.test.com
ServerAlias www.admin.test.com
ErrorLog "C:\wamp\www\test\logs\error.log"
CustomLog "C:\wamp\www\test\logs\access.log" common
<Directory "c:/wamp/www/test/administrator">
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
test.com works fine, but the admin doesn't. It only displays a white blank page. I also noticed that the redirection works in admin since the page title loads the admin page title.
I'm using Joomla! 3.4.4 Stable, and WAMP Server with Apache/2.4.9 and PHP 5.5.12.
In your configuration.php file under your Joomla website, set $error_reporting to "maximum". This will show you what the error really is and will give you pinpoints on how to fix it.

How to configure different Virtual Hosts based on apache + php_cgi and apache+mod_php?

everybody.
I have a Cent OS 6.6 server with Apache + mod_php site (site1.local). I need to configure second site (site2.local) with php_cgi. So, I created a user, gave him permissions on www-folder, configured site1 as mod_php, created a phpinfo.php. Also, I installed php-cgi,and try to configure virtual hosts, works only first site, on the second site is error:
the requested url /cgi-bin/phpinfo.php was not found onthis server.
That's my configs:
cat /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
ServerAdmin webmaster#site1.local
DocumentRoot /var/www/wwwmaster/site1.local
ServerName site1.local
ServerAlias www.site1.local
ErrorLog logs/site1.local-error_log
CustomLog logs/site1.local-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#site2.local
DocumentRoot /var/www/wwwmaster/site2.local
ServerName site2.local
ServerAlias www.site2.local
ScriptAlias /cgi_bin/ /usr/bin/php-cgi/
Action php-cgi /cgi-bin
AddHandler php-cgi php
<Directory /usr/bin/php-cgi>
Allow from all
</Directory>
<Directory "/var/www/wwwmaster/site2.local/">
<FilesMatch "\.php">
SetHandler php-cgi
</FilesMatch>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
ErrorLog logs/site2.local-error_log
CustomLog logs/site2.local-access_log common
</VirtualHost>
What I've done wrong and how can I fix that?
You only have to uncomment the line that says NameVirtualServer *:80 in your apache config file.
If you want virtual server for more than one port, simply put as many NameVirtualServer *:[port number] in the apache config file as you need.

Windows 7 - XAMPP: vhost keeps redirecting

My hosts file. (Win 7 ultimate)
127.0.0.1 localhost
127.0.0.1 efmm.local
My httpd-vhosts.conf (XAMPP 1.7.3)
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost efmm.local>
DocumentRoot "C:\xampp\htdocs\EFMM"
ServerName efmm.local
ErrorLog "logs/efmm.localhost-error.log"
CustomLog "logs/efmm.localhost-access.log" combined
<Directory "C:\xampp\htdocs\EFMM">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Problem
When I go to efmm.local , the browser redirects to localhost/EFMM.
I also tried <VirtualHost 127.0.0.1:80> instead of <VirtualHost efmm.local>, same result.
Here's how I do it on XP (don't expect it to make any difference in 7)
First, add the virtual host's domain to your HOST (as you did)
I don't put the virtual host webroot under the main htdocs directory. I create a specific webroot next to it, which gives me the following tree:
C:\XAMPP\htdocs
C:\XAMPP\htdocs-seconddomain
C:\XAMPP\htdocs-thirddomain
etc..
So in your case, I would create c:\XAMPP\htdocs-efmm alongside C:\XAMPP\htdocs
Then:
Edit XAMPP's httpd.conf, add and define any Apache options for the new document root, i.e.:
<Directory "C:/XAMPP/htdocs-efmm">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
[any extra apache module instructions you may require]
Order allow,deny
Allow from all
</Directory>
Edit XAMPP's httpd-vhosts.conf, adding the virtual host:
<VirtualHost *:80>
ServerName efmm.local
ServerAlias www.efmm.local
DocumentRoot "C:/XAMPP/htdocs-efmm"
ErrorLog "C:/XAMPP/htdocs-efmm/error.log"
DirectoryIndex index.php index.html index.htm
</VirtualHost>
Restart XAMPP. You may browse your new virtual host now.