If u have apache installed. U need to set up virtual hosting for your server. editing /etc/httpd/conf/httpd.conf and u add domains like this: <VirtualHost *:80> DocumentRoot /home/domain1.com/htdocs ServerName domain1.com ServerAlias *.domain1.com </VirtualHost> <VirtualHost *:80> DocumentRoot /home/domain2.com/htdocs ServerName domain2.com ServerAlias *.domain2.com </VirtualHost>
Thank you for your replay.. i have some doubts, If i have a domain say www.domain.com which is using one public ip 10.20.10.10,and The DNS is pointed in www.name.com(Domain registrar) Now i want to host another website say www.domain2.com,In the DNS(domain registrars DNS).I should use the same DNS configuration for the second and third domain ( 10.20.10.10)? OR I shold maintain my own DNS server to find the other website? and i have some requirement if i type 10.20.10.10 it should display the www.domain.com instead of blank page can you tell me the steps to do that? Thank You
you can host your dns with your domain registrar and put the same ip (ip of your server) in A record for both domains and why you need anything to show by ip instead of domain name?
i think there is either a "default server" entry or you put * in ServerName to access by ip. but i strongly advise AGAINST it. Do you want google to index your site by ip?
your web server identfies which virtual domain you want to acces, depending on the http header if you type the ip address which domain would you like to access
if you want multiple sites on single ip it will be port based in other case, it will be hostname (domain.com) based.... but its definitely possible
you have to define virtual host and the same can be done via cpanel using add-on domains, check host name details here hostname