Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virtual Hosting 2

Status
Not open for further replies.

brettr1234

Technical User
Jun 2, 2002
42
CA
Ok, I was using apache2, and i couldn't get virtual hosting to work. Eventually after fiddiling with pretty much every setting i changed UseCanoncialname to on and it worked. But Php is not working correctly and i dont know how to fix it. So i installed the debian package. It works fine and php is working, but virtual hosting is not. I don't want to spend weeks again, does anyone know what could be causing this?

These are my virtual host settings.

NameVirtualHost 65.27.115.198

<VirtualHost 65.27.115.198>
ServerAdmin support@fjrconsulting.net
DocumentRoot /var/ServerName fjrconsulting.net
ErrorLog /var/log/apache/TransferLog /var/log/apache/</VirtualHost>

<VirtualHost 65.27.115.198>
ServerAdmin support@fjrconsulting.net
DocumentRoot /var/ServerName ErrorLog /var/log/apache/TransferLog /var/log/apache/</VirtualHost>

<VirtualHost 65.27.115.198>
ServerAdmin fjr@fjrconsulting.net
DocumentRoot /var/ServerName sowhatonline.com
ErrorLog /var/log/apache/TransferLog /var/log/apache/</VirtualHost>

<VirtualHost 65.27.115.198>
ServerAdmin fjr@fjrconsulting.net
DocumentRoot /var/ServerName ErrorLog /var/log/apache/TransferLog /var/log/apache/</VirtualHost>
 
Well thanks but it didnt work hehe. Any other ideas anyone?
 
Well no luck again hehe. I dont believe you can use * in apache 1.3.9-14, I remember reading that in one of their documentation files. I tried it anyway and this is the error it gives me

[Sun Jun 2 20:56:17 2002] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Sun Jun 2 20:56:17 2002] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Sun Jun 2 20:56:17 2002] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Sun Jun 2 20:56:17 2002] [warn] NameVirtualHost *:80 has no VirtualHosts
 
By any chance did these lines get uncommented?

#<VirtualHost _default_:*>
#</VirtualHost>

If you tried to use an apache configuration tool, goofy stuff is gonna happen. :eek:)

 
I get this

VirtualHost configuration:
65.27.115.198:80 is a NameVirtualHost
default server fjrconsulting.net (/etc/apache/httpd.conf:266)
port 80 namevhost fjrconsulting.net (/etc/apache/httpd.conf:266)
port 80 namevhost (/etc/apache/httpd.conf:275)
port 80 namevhost sowhatonline.com (/etc/apache/httpd.conf:284)
port 80 namevhost (/etc/apache/httpd.conf:293)
 
That looks ok to me - ok while I'm doing dumb questions, do you have httpd running more than once? could be it didn't shut down before you restarted. <grasping at straws> :)
 
what flavor of linux are you running and can you put a copy of httpd.conf in one of you document roots so I can take a peek at it. You will have to give it a .txt extension.
 
Hi mate,

Just a side note but you only avtually need 2 of those Vhost directives.

<VirtualHost 65.27.115.198>
ServerAdmin support@fjrconsulting.net
ServerAlias fjrconsulting.net
DocumentRoot /var/ServerName ErrorLog /var/log/apache/TransferLog /var/log/apache/</VirtualHost>

<VirtualHost 65.27.115.198>
ServerAdmin fjr@fjrconsulting.net
ServerAlias sowhatonline.com
DocumentRoot /var/ServerName ErrorLog /var/log/apache/TransferLog /var/log/apache/</VirtualHost>

Use the ServerAlais rather than a seperate Vhost directive.

Hope this helps
Wullie

 
Well, I added the ServerAlias thansk for taht tip, but still no luck it goes to the same page.
 
I take it you meant comment that line, i just did and no luck lol
 
ok - maybe it cuz it's late in the day but I don't see what could be making it not work. I did notice that you have things a little doubled up. For example to have port 80 and listen 80. Then you have ServerName, NameVirtualHost , BindAddress and <VirtualHost > all with your ip. I would comment out the ServerName in the main server section. Leave port 80 and comment out listen. Change NameVirtualHost to * instead of ip and use <VirtualHost *> for all the containers. In some distros, UseCanonicalNames Off needs to be in each vhost container. Other than that I'm stumped.
 
lol

Yes I did mean comment.. It's 4:20am here and my brain is just not thinking straight.

Right, I am going to give a possible workaround for this problem and it is up to you to decide whether you want to use it or not.

If you uncomment that Vhost_alias again then you can set up Apache to use that module to server your Vhosts and it makes life a lot easier.

Instead of defining each VHost seperatly, you simple include something like the following.

<VirtualHost *:80>
UseCanonicalName off
VirtualDocumentRoot / VirtualScriptAlias / ServerSignature EMail
</VirtualHost>

Now, with the above set-up, when a domain name is called, Apache looks for a directory with the same name as the domain called.

So for example, If the domain called was then Apache would look in the /www/ directory and would then substitute /%0 for a subdirectory called
This way is required for larger hosting set-ups because there is no need to restart every time a new domain is added and also to save space in the httpd.conf file, but the set-up is just as effective for smaller servers as well.

If you want to try this and have any problems, let me know and I will run through them with you.

Hope this helps
Wullie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top