LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 02-17-2011, 06:23 PM   #1
Mountain
Member
 
Registered: Nov 2007
Location: A place with no mountains
Distribution: Kubuntu, sidux, openSUSE
Posts: 214

Rep: Reputation: 41
Help - apache serves up my website from any URL!


I'm running Ubuntu 10.04 with apache, rails, mysql, etc.

My rails site is running at www.example.com. I'm intending to use named-based virtual hosting and I have a virtual hosts file configured/enabled for www.example.com. My site is hosted on Amazon EC2.

The problem is that if I set up a new DNS record -- say test.example.com -- and browse to that, my site www.example.com is served up! That's without configuring any new virtual hosts.

And the same is true if I go to my DNS records and define test2.example.com, etc. Without touching my server, these new URLs serve up my website.

That's not what I want! I want to use name-based virtual hosting and host different sites for each subdomain.

Where could my problem be?

Here's my virtual hosts file:
Code:
ServerSignature Off
ServerTokens Prod
#NameVirtualHost *:80 - this is defined in a default config file already.

<VirtualHost *:80>
	ServerAdmin webmaster@example.com
	UseCanonicalName On

	ServerName www.example.com
	DocumentRoot /home/ubuntu/example/public
	ErrorLog /home/ubuntu/example/log/error.log

	<Directory /home/ubuntu/example/public/>
		   AllowOverride all
		   Options -MultiViews 
	</Directory>

</VirtualHost>

UPDATE: now I understand a bit more... apparently my real problem is not what I thought it was. My real problem now appears to be that when I copy this virtual hosts file and edit it to add a new subdomain name, set up the corresponding site, etc., and enable the virtual host (a2ensite) and restart (graceful), apache immediately stops serving up any websites. Apparently apache crashes although I do not see any error messages. But all my sites go down and I have to revert and then restart apache.

I thought this was because my virtual host file (pasted above) had an error. So I thought I would start by getting that first file right. Apparently it is right. So now I need to understand why adding a second virtual host causes all sites to stop being served up.

Last edited by Mountain; 02-17-2011 at 06:54 PM.
 
Old 02-18-2011, 12:39 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Quote:
The problem is that if I set up a new DNS record -- say test.example.com -- and browse to that, my site www.example.com is served up! That's without configuring any new virtual hosts.

And the same is true if I go to my DNS records and define test2.example.com, etc. Without touching my server, these new URLs serve up my website.
This is normal. Without different VirtualHost definitions, apache serves the default vhost.

Follow the instructions here, to setup vhosts in apache.

Regards
 
  


Reply

Tags
apache, ubuntu, webserver



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
Apache serves on localhost, but not the network gvaught Linux - Server 1 11-28-2010 11:22 PM
[SOLVED] How to find URL for xampp website on my server anon091 Linux - Newbie 2 03-02-2010 09:01 AM
How to know which pages does Apache serves RockmanExe Linux - Security 1 05-20-2006 03:49 PM
Loading website URL in a Cron Job njdube Linux - General 5 04-17-2006 11:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:55 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration