httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony G. Atkielski" <anth...@atkielski.com>
Subject Re: [users@httpd] Accessing web pages on tthe server by domain name.
Date Tue, 25 Jan 2005 20:17:23 GMT
ugunja ugunja wrote:

>Hello,
>I have apache running on FC1 and I acan access the web pages by ip address
>of the server http://192.168.0.x but I am unable to configure the server so
>that I can access the web pages by domain name e.g. http://www.mydomain.com.
>Any help how to configure it?

Use NameVirtualHost to specify the IP address(es) on which you want to
handle name-based hosts, like this:

NameVirtualHost 123.123.120.123

You can put an asterisk if you want to accept named-based requests on
all IP addresses.

You then specify specific addresses in <VirtualHost> sections for each
domain name, and you use ServerName to say which host is served by which
section.  For example (this is how my configuration does it):

NameVirtualHost *:80  [anything on port 80 can be name based]
...
<VirtualHost *:80>  [first domain to be served]
ServerName www.myfirstdomain.com  [domain name to be served]
...
</VirtualHost>

<VirtualHost *:80>  [second domain to be served]
ServerName www.myseconddomain.com  [domain name to be served]
...
</VirtualHost>

The first virtual host is the one that gets served if Apache can't find
a match on the server name for any virtual host.  In the above
configuration, Apache accepts any request on any IP address, provided
it's for port 80.  It then looks down the list of virtual hosts and
picks the one that has a ServerName or ServerAlias that matches the
domain name provided by the calling client, and serves that (if none
match, the first virtual host is served).

-- 
Anthony



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message