Apache and Virtual Servers...
I have never set up a apache virtual server yet... hopefully in a week I can say different..
Here's my question.. Can you set up multiple web sites on the same IP address.. and have them be distinguished by the name ?? This does sound funny to me... but I was told you can do this ?? is this really possible ?? ( It was some ISS guys that told me this was possible.. and they think Apache can do it to... but I don't know how... :(.....) Anybody out their with this kind of experience ?? Scott |
Yes you can.
If your domain is mydomain.com then you need to setup domain alias's and have your virtual servers default to them You could have sales.mydomain.com and info.mydomain.com, then setup different document directories. checkout apache.org for all the directives. The virtual servers inherit from the default so be careful when setting up you directives. # default DocumentRoot /www ServerName mydomain.com # Sales <VirtualHost> DocumentRoot /www/sales ServerName sales.mydomain.com </VirtualHost> # Info <VirtualHost> DocumentRoot /www/info ServerName info.mydomain.com </VirtualHost> |
Apache lets you handle multiple hostnames on a single IP via the "NameVirtualHost" directive.
You can specify either an address alone or an address followed by ":port", usually ports 80 or 443 (SSL). If no port is specified, the value of "Port" defined earlier in the config is assumed. NameVirtualHost 192.0.0.10:80 NameVirtualHost 192.0.10.3 <VirtualHost 192.0.0.10:80> ServerName foo.bar.org ServerAlias www.foo.bar.org DocumentRoot /wherever/foo.bar.org ... </VirtualHost> <VirtualHost 192.0.0.10:80> ServerName clark.bar.org DocumentRoot /blah/clark.bar.org ... </VirtualHost> <VirtualHost 192.0.10.3> ServerName mili.bar.org ... </VirtualHost> ..and so on. Note that SSL VHosts cannot have their own individual certificates due to the nature of the HTTPS protocol. What normally happens is the certificate for the first VHost is used for all subsequent ones. |
All times are GMT -5. The time now is 04:00 PM. |