Ever wonder to run single IP address over multiple domains?
Rephrasing: Run multiple site/domain on single ip?
Well, here comes name based routing into picture.
You can create virtual host entry in your apache's or nginx's site-available folder, and the you can enable it to point your domain to your vps/server ip address.
Here is how a typical vhost entry look like:
<VirtualHost *:80>
ServerName yourDomainNameGoesHere.com
serverAdmin adminEmailId@abc.com
DocumentRoot /path/to/yourDomainNameGoesHere.com/root_directory/
<Directory /path/to/yourDomainNameGoesHere.com/root_directory/ >
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
That's it. This is all you need to let your server to identify request coming to "
yourDomainNameGoesHere.com". In name based routing , your server will read the url for serverName and then choose the vhost configuration that best matches to it.
Question: How will a domain know what is my server IP?
Answer: For that, you need to go to your domain panel and inside dns management tab change the dns settings. Change A-record to point your domain to your server IP.
Rephrasing: Run multiple site/domain on single ip?
Well, here comes name based routing into picture.
You can create virtual host entry in your apache's or nginx's site-available folder, and the you can enable it to point your domain to your vps/server ip address.
Here is how a typical vhost entry look like:
<VirtualHost *:80>
ServerName yourDomainNameGoesHere.com
serverAdmin adminEmailId@abc.com
DocumentRoot /path/to/yourDomainNameGoesHere.com/root_directory/
<Directory /path/to/yourDomainNameGoesHere.com/root_directory/ >
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
That's it. This is all you need to let your server to identify request coming to "
yourDomainNameGoesHere.com". In name based routing , your server will read the url for serverName and then choose the vhost configuration that best matches to it.
Question: How will a domain know what is my server IP?
Answer: For that, you need to go to your domain panel and inside dns management tab change the dns settings. Change A-record to point your domain to your server IP.
No comments:
Post a Comment