LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 10-30-2009, 05:55 AM   #1
slimjim
Member
 
Registered: Apr 2004
Location: east midlands, england
Distribution: Ubuntu 9.04
Posts: 56

Rep: Reputation: 15
Apache2 - virtual host defaulting to default host


Hi,

Bit of an odd one, this. I've migrated a website from my old server to a new machine. Both servers run Ubuntu + Apache2. Both only serve a single site, apart from the default site.

I've flipped the domain name to the new IP address.

The trouble is that after moving the virtual host config over into sites-available, with the necessary link in sites-enabled, Apache attempts to serve from the default web root (/var/www) rather than the actual site content (in /var/www/technology). So for example, an attempt to browse to

technology.smeg.com/wiki

.. gives a 404, and a message in the error log shows that it attempted to find /var/www/wiki.

Similarly, browsing to technology.smeg.com gives the default site index page.

Here's /etc/apache2/sites-enabled/technology.smeg.com:

Code:
<VirtualHost *>
ServerName technology.smeg.com
ScriptAlias /support/ /usr/lib/cgi-bin/
ScriptAlias /lookuptable/ /usr/lib/cgi-bin/
AddHandler cgi-script .cgi
DocumentRoot /var/www/technology
</VirtualHost>
Now, I can "fix" this by removing the 000-default entry from sites-enabled. If I do that, Apache will serve the correct content from /var/www/technology.

But that kills the default site, which I want to keep, and I didn't have to do that on the old box. It also destroys some default settings used by the virtual host, I think.

I've changed the domain name to protect the innocent.

Any ideas?


.. ah never mind .. just fixed it! I noticed that the 'default' file linked from 000-default is different on the older server. When I replaced the line:

Code:
<VirtualHost *:80>
with

Code:
NameVirtualHost *
<VirtualHost *>
.. to match the old server, then restarted - it all works.

Will post this anyway, in case it helps someone else.
 
Old 10-31-2009, 01:47 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
To get this of the zero-reply list

Thanks for the solution. Can you please mark the tread as solved using the thread tools just above the first post; this might help others that are looking or solutions for the same problem.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual host apache2 duxbuz Linux - Newbie 12 10-09-2009 01:53 PM
Apache2 virtual host. hgb Linux - Networking 10 01-24-2009 02:05 AM
apache2 help -Virtual Host- Fredstar *BSD 4 06-06-2005 01:09 PM
Apache 2 defaulting to first virtual host QtCoder Linux - Networking 7 02-16-2005 07:43 PM
Can't do Apache2 virtual host different ports SK_pt Linux - Software 3 01-30-2005 07:04 PM


All times are GMT -5. The time now is 01:21 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration