GlennB
March 3rd, 2008, 03:33 PM
Hi All,
I feel a bit dumb asking for help with this - I'm sure it's a simple syntax issue, but I've read a bunch, and can't fix it. I'm a newbie with Apache and it probably shows!
I'm trying to accomplish a simple task - set up virtual hosts on Apache (Gutsy LAMP server install) to use a couple of sub domains, like this:
www.mydomain.co.uk --> /var/www
drupal.mydomain.co.uk --> /var/www/drupal
wordpress.mydomain.co.uk --> /var/www/wordpress
I intend to have static html pages at the site root (/var/www).
This is for internal use only, so I will make the necessary additions to hosts files on workstations - there won't be any DNS involved.
I thought I could simply add virtualhost stanzas to the existing 'default' site config in /etc/apache2/sites-available and then use the existing symlink in ../sites-available. I'm doing something wrong - each of the URLs
www.mydomain.co.uk
drupal.mydomain.co.uk
wordpress.mydomain.co.uk
resolves, but they all load the index.html in the main document root (/var/www). What am I doing wrong??
Here's the current 'default' file:
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName thebigshed.co.uk
ServerAlias www.thebigshed.co.uk
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin glenn@localhost
DocumentRoot /var/www/drupal/
ServerName drupal.thebigshed.co.uk
ErrorLog /var/log/apache2/drupal-error_log common
CustomLog /var/log/apache2/drupal-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin glenn@localhost
DocumentRoot /var/www/wordpress/
ServerName wp.thebigshed.co.uk
ErrorLog /var/log/apache2/wp-error_log common
CustomLog /var/log/apache2/wp-access_log common
</VirtualHost>
It's driving me nuts! Any help would be greatly appreciated.
Many thanks,
Glenn.
I feel a bit dumb asking for help with this - I'm sure it's a simple syntax issue, but I've read a bunch, and can't fix it. I'm a newbie with Apache and it probably shows!
I'm trying to accomplish a simple task - set up virtual hosts on Apache (Gutsy LAMP server install) to use a couple of sub domains, like this:
www.mydomain.co.uk --> /var/www
drupal.mydomain.co.uk --> /var/www/drupal
wordpress.mydomain.co.uk --> /var/www/wordpress
I intend to have static html pages at the site root (/var/www).
This is for internal use only, so I will make the necessary additions to hosts files on workstations - there won't be any DNS involved.
I thought I could simply add virtualhost stanzas to the existing 'default' site config in /etc/apache2/sites-available and then use the existing symlink in ../sites-available. I'm doing something wrong - each of the URLs
www.mydomain.co.uk
drupal.mydomain.co.uk
wordpress.mydomain.co.uk
resolves, but they all load the index.html in the main document root (/var/www). What am I doing wrong??
Here's the current 'default' file:
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName thebigshed.co.uk
ServerAlias www.thebigshed.co.uk
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin glenn@localhost
DocumentRoot /var/www/drupal/
ServerName drupal.thebigshed.co.uk
ErrorLog /var/log/apache2/drupal-error_log common
CustomLog /var/log/apache2/drupal-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin glenn@localhost
DocumentRoot /var/www/wordpress/
ServerName wp.thebigshed.co.uk
ErrorLog /var/log/apache2/wp-error_log common
CustomLog /var/log/apache2/wp-access_log common
</VirtualHost>
It's driving me nuts! Any help would be greatly appreciated.
Many thanks,
Glenn.