|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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> |
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
I found out the problem...
Very plain and simple... Listen 80 Listen 81 <VirtualHost *:81> DocumentRoot "/apache group/apache/www2" </VirtualHost> |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > VirtualHost - Ports |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|