-
October 16th, 2004, 08:29 AM
#1
Member
Apache2 Virtual Hosts
I need help setting up my virtual hosts. Ive tried just about every combination said in the documentation. This is my latest try:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName http://********.ath.cx
DocumentRoot C:\Program Files\Apache Group\Apache2\htdocs\tmj
</VirtualHost>
<VirtualHost *:80>
ServerName http://*******.ath.cx
DocumentRoot C:\Program Files\Apache Group\Apache2\htdocs\sf
</VirtualHost>
-
October 16th, 2004, 10:20 AM
#2
You have to put the name of the host-header in the VirtualHost directive (unless you just want them running on different port numbers).
Putting it in the servername is a good idea too.
Having the port number in is optional, but it helps in complex configurations. You can put more than one host name in the VirtualHost e.g.
Code:
<VirtualHost www.myfunkysite.com:80 myfunkysite.com:80 members.myfunkysite.com:80 secure.myfunkysite.com:443>
...
</VirtualHost>
Slarty
-
October 16th, 2004, 03:39 PM
#3
I just stole this from the tut I did on reverse proxy servers (http://www.antionline.com/showthread...hreadid=237755)
NameVirtualHost 192.168.2.91:443
<VirtualHost 192.168.2.91:443>
# set the virtual host name, this is how it knows we mean testserver
ServerName ts1rp.somedomain.com
</VirtualHost>
<VirtualHost 192.168.2.91:443>
# Let Apache Know that ts2rp is really ts2 SSL server
ServerName ts2rp.somedomain.com
</VirtualHost>
I think it would probably work if you used the address/name in the NameVirtualHost and VirtualHost directives (and they MUST match). I of course dropped all the stuff non-relevant to the discussion from the VirtualHost sections; however, as far as definitions go, it should work.
EDIT: Just thought about it, if you are actually using multiple IPs for your site this could cause problems (I just had my DNS records point to the same IP for the different virtualserver domain names). There is a syntax there for what you have to work and I don't see anything obviously wrong with it, I will post back if I can confirm that...
Also note, that the configuration came from a 1.3.X Apache server, not 2.0 (for whatever reason, I can't get 2.X to consistently work with SSL on Solaris). I would assume that the syntax is the same between the two; however, you know the old saying about assumptions...
EDIT2:
http://httpd.apache.org/docs-2.0/vhosts/examples.html
As far as I can tell, your syntax looks good, except under ServerName, I don't think 'http://' should go there, just the DNS name.
There is only one constant, one universal, it is the only real truth: causality. Action. Reaction. Cause and effect...There is no escape from it, we are forever slaves to it. Our only hope, our only peace is to understand it, to understand the 'why'. 'Why' is what separates us from them, you from me. 'Why' is the only real social power, without it you are powerless.
(Merovingian - Matrix Reloaded)
-
October 16th, 2004, 08:23 PM
#4
Member
I still have not been able to make it work. I get the error, "The requested operation has failed."
My new conf:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ********.ath.cx
DocumentRoot C:\Program Files\Apache Group\Apache2\htdocs\tmj
</VirtualHost>
<VirtualHost *:80>
ServerName *******.ath.cx
DocumentRoot C:\Program Files\Apache Group\Apache2\htdocs\sf
</VirtualHost>
I solved my problem, thanks everyone.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|