Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 16th, 2002, 10:09 PM
Chad87 Chad87 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: USA
Posts: 21 Chad87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Chad87 Send a message via AIM to Chad87 Send a message via Yahoo to Chad87
Question VirtualHost - Ports

I have looked through this whole forum, and I still can't get my virtual host to work. I want to have 2 ip addresses with 2 ports be seperate websites, using virtualhost.
So..
111.111.111.111:80
and
111.111.111.111:81
are 2 seperate websites..

This is what I have right now and no matter if I use prt 80 or port 81, it still goes to the document root of port 80.

NameVirtualHost 1.1.1.1:80
NameVirtualHost 1.1.1.1:81

Listen 80
Listen 81

<VirtualHost 1.1.1.1:80>
Port 80
ServerName 1.1.1.1:80
DocumentRoot /Apache/htdocs"
</VirtualHost>

<VirtualHost 1.1.1.1:81>
Port 81
ServerName 1.1.1.1:81
DocumentRoot /Apache/www2
</VirtualHost>

And I replaced 1.1.1.1 with my real ip address.
Anyone know what's wrong?

Reply With Quote
  #2  
Old February 17th, 2002, 05:42 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
First off, you can't specify this:

NameVirtualHost 1.1.1.1:80
NameVirtualHost 1.1.1.1:81

Instead, you need to use Listen.

>> I want to have 2 ip addresses with 2 ports

You don't have two IPs, just ONE, but on two different ports.

>> ServerName 1.1.1.1:80

This format is incorrect. ServerName must either be a FQDN or IP, and without the port, of course.

>> DocumentRoot /Apache/htdocs"

Missing opening quote.

Here is an example:

Port 80
Listen 80
Listen 81
# You don't need to specify port 80 below
NameVirtualHost 111.111.111.111
<VirtualHost 111.111.111.111>
# You then can't use 1.1.1.1 as your ServerName
ServerName 111.111.111.111
DocumentRoot "/Apache/htdocs"
</VirtualHost>
<VirtualHost 111.111.111.111:81>
ServerName 111.111.111.111
DocumentRoot "/Apache/www2"
</VirtualHost>

Reply With Quote
  #3  
Old February 17th, 2002, 11:10 AM
Chad87 Chad87 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: USA
Posts: 21 Chad87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Chad87 Send a message via AIM to Chad87 Send a message via Yahoo to Chad87
I have this now...

Port 80
Listen 80
Listen 81
# You don't need to specify port 80 below
NameVirtualHost 1.1.1.1
<VirtualHost 1.1.1.1>
ServerName 1.1.1.1
DocumentRoot "C:\program files\apache group\apache\htsdocs"
</VirtualHost>
<VirtualHost 1.1.1.1:81>
ServerName 1.1.1.1
DocumentRoot "C:\program files\apache group\apache\www2"
</VirtualHost>

I went ahead and tried putting the full document root, but that didn't help. What it does now is when you got to: 1.1.1.1 it is fine, it goes to the port 80 website which it is supposed too. But when I go to 1.1.1.1:80, the website loads but it shows the port 80 website (as in it is using the documentroot of port 80)

Do you know what's wrong?

Reply With Quote
  #4  
Old February 17th, 2002, 11:13 AM
Chad87 Chad87 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: USA
Posts: 21 Chad87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Chad87 Send a message via AIM to Chad87 Send a message via Yahoo to Chad87
I just noticed something..
when I was typing in the document root for the port 80 one in the virtual host, I misspelled htdocs (I put htsdocs) which means it is just ignoring the virtualhosts, I can put anything for the virtualhost documentroot and it will still use the default document root (the documenttoot not include in the virtualhost)

And I tried taking off the global documentroot (the one not in the virtualhost) and it got a 404 Not found.

Reply With Quote
  #5  
Old February 17th, 2002, 06:24 PM
Chad87 Chad87 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: USA
Posts: 21 Chad87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Chad87 Send a message via AIM to Chad87 Send a message via Yahoo to Chad87
I found out the problem...
Very plain and simple...

Listen 80
Listen 81
<VirtualHost *:81>
DocumentRoot "/apache group/apache/www2"
</VirtualHost>

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > VirtualHost - Ports


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT