LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-26-2006, 04:46 PM   #1
dave`2005
Member
 
Registered: Aug 2005
Distribution: Ubuntu 7.10, Slackware 12
Posts: 270

Rep: Reputation: 30
Apache virtual host problem.


Hi all, im having problems getting a virtual host going, here is the part of my httpd.conf:
Code:
NameVirtualHost www.url.com:80
#
<VirtualHost www.url.com:80>
    ServerAdmin webmaster@url.com
    DocumentRoot /var/www/url.com
    ServerName www.url.com
    ErrorLog /var/log/apache/url.com-error_log
    CustomLog /var/log/apache/url.com-access_log common
</VirtualHost>
The place i bought my url from is currently just forwarding to my IP address, i havent set up any dns type stuff, i was hoping it would be ok, but when i type my url into a browser it gives me the default "Hey it worked!" default page. I dont know what im doing wrong

Im using apache 1.3.34

Any help greatly appreciated.
 
Old 05-26-2006, 05:31 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
What are you typing, specifically, into your browser's address bar? In order for virtual hosting to work, you will need to be typing "http://www.url.com" You need the domain format, not an ip address. This is because multiple virtual hosts can exist at a single IP address, and Apache uses the domain component of the URL to figure out which one.

But you said you do not have any dns, so that means you might be actually typing something like "http://192.168.0.1", and this latter form will NOT go to your virtual host. It will go to your main host (that sounds like what you're seeing).

If the above describes your case, you can test the virtual host by adding the following ...
Code:
192.168.0.1 www.url.com
... to your /etc/hosts file and then typing "http://www.url.com" into your browser's address bar.

/etc/hosts is the location of the file if your browser is on a Linux box. If you're browser is on a Windows box, I think the path to the file is c:/winnt/system32/Drivers/etc/hosts (something like that anyway - Windows tries hard to bury it deep down in a location you'd never suspect)

[edit]
Obviously, you should enter your REAL ip address into that hosts file. 192.168.0.1 is just an EXAMPLE!
[/edit]

Last edited by haertig; 05-26-2006 at 05:34 PM.
 
Old 05-26-2006, 10:11 PM   #3
dave`2005
Member
 
Registered: Aug 2005
Distribution: Ubuntu 7.10, Slackware 12
Posts: 270

Original Poster
Rep: Reputation: 30
Thanks for the reply.

Im typing www.url.com into the browser and im getting the apache default page you get when its just been installed correctly, so my apache is actually working, the virtual host part isnt

The place i bought the domain name from has 2 options in the hosting menu, they host it (for a fee of course) or "external website (web forwarding)", you gotta put in a url or IP.

I chose the web forwarding and put my IP address in. But as i said when i try my url in a browser it gives me the default apache is working page.

Ive been messing around with the httpd.conf but to no avail Any suggestions?
 
  


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
Apache Virtual Host Problem eckertc1 Linux - Newbie 11 03-23-2005 04:31 PM
Apache and Virtual Host Problem sekondborn Linux - Software 9 02-12-2005 03:26 PM
Apache virtual host problem Adrohak Linux - Software 3 07-18-2004 05:17 PM
Apache Virtual Host Problem clanx Linux - Software 3 01-07-2004 02:36 AM
Virtual Host Problem using Apache ataber Linux - Newbie 2 01-27-2003 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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