Results 1 to 4 of 4
i want to configure name based virtual hosting.
suppose my ip address is 100.101.102.103
i would like to have 3 websites on the same ip.
www.abc.com
www.xyz.com
www.efg.com
the default ...
- 08-03-2005 #1Just Joined!
- Join Date
- Mar 2005
- Location
- india
- Posts
- 87
name based virtual hosting
i want to configure name based virtual hosting.
suppose my ip address is 100.101.102.103
i would like to have 3 websites on the same ip.
www.abc.com
www.xyz.com
www.efg.com
the default directory is /var/www/html. what are the changes i need to do in the /etc/named.conf and /var/named/<forward-zone> and /var/named/<reverse-zone> files ?
i have pasted concerned lines of my httpd.conf file. what modifications i need to do in this file ?
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
- 08-03-2005 #2Linux Newbie
- Join Date
- Jul 2005
- Location
- ~/home
- Posts
- 105
- 08-03-2005 #3Just Joined!
- Join Date
- May 2005
- Posts
- 52
here is a very simplified config. The first vhost deny's access to anything not specifically listed below it. I would use that. Then you of course need your DNS records for domain abc, xyz and efg to point to the correct IP addy. This config assumes that www.abc.com will be placed in /abc under html. If not adjust name / location accordinagly. If /abc is above the html directory, you may need to configure Alias to it. Hope this helps.
Should get you started.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName default.only
<Location />
Order allow,deny
Deny from all
</Location>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/abc"
ServerName www.abc.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/xyz"
ServerName www.xyz.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/efg"
ServerName www.efg.com
</VirtualHost>
- 08-04-2005 #4Just Joined!
- Join Date
- Mar 2005
- Location
- india
- Posts
- 87
following is the concerned lines of my httpd.conf
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html
ServerName server.sarayu3.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
Documentroot /var/www/html1
ServerName server.sarayu2.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
------------------------------------------------------
following is my
# cat /var/named/chroot/var/named/server.sarayu3.com.zone
$TTL 86400
@ IN SOA server.sarayu3.com. root.server.sarayu3.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS server.sarayu3.com.
IN A 192.168.1.3
www IN CNAME server.sarayu3.com.
www.server.sarayu2.com. IN A 192.168.1.3
-------------------------------------------
# cat /var/named/chroot/var/named/1.168.192.in-addr.arpa.zone
$TTL 86400
@ IN SOA server.sarayu3.com. root.server.sarayu3.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS server.sarayu3.com.
3 IN PTR server.sarayu3.com.
3 IN PTR server.sarayu2.com.
-----------------------------------------------------------
following is the changes i have made to named.conf
zone "server.sarayu3.com" IN {
type master;
file "server.sarayu3.com.zone";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.in-addr.arpa.zone";
allow-update { none; };
};
---------------------------------------------------------
http://server.sarayu3.com is working but http://server.sarayu2.com is not working. where i am wrong ? pliz help


Reply With Quote