how can i prevent user from displaying contents of my vps. Currenty, I have an Ubuntu-powered vps and I install wordpress blog on it which is intended for my domain1.com
. I know its possible to use the VPS IP to another domain by adding an A record
which points to the IP. But i have a domain2.com
and when i add an A Record
to it. It will display the blog from domain1.com
and also, when I try to key in IP address to the browser, I can see the blog I made. How can I specify its content that is viewable only for that particular domain?

- 11
- 1
- 4
-
possible duplicate of [Apache: Scammers point dozens of domain names at my dedicated IP. How to prevent this?](http://serverfault.com/questions/271656/apache-scammers-point-dozens-of-domain-names-at-my-dedicated-ip-how-to-prevent) – Ladadadada May 01 '14 at 11:44
-
[Also covered with actual config examples in this question](http://serverfault.com/questions/585089/a-domain-ive-never-heard-of-resolves-to-my-website). – Ladadadada May 01 '14 at 11:46
1 Answers
Your VPS runs a web server (Apache, nginx or similar) and the web server needs to be setup to "handle multiple domains". In more technical terms you need to setup some virtual hosts or vhosts to serve each of the domains you want to host.
If you only have one IP address you will need to do name-based vhosting where the web server decides the content based on the hostname the user types into his/her browser. E.g. you will have one vhost for domain1.com and one vhost for domain2.com. If someone sets up their own DNS and makes domain3.com point to your VPS then they will be served the default vhost. It is configurable which one is default.
See here for Apache name-based vhosting: https://httpd.apache.org/docs/2.2/vhosts/name-based.html
If you are not using Apache tell us what you use.

- 336
- 2
- 4
- 8
-
Then you just need to setup some name-based vhosts. The relevant config files for you on Ubuntu (or any other Debian like distro) is in */etc/apache* and */etc/apache/sites-available*. Ubuntu should also have the a2ensite to enable sites (vhosts) after you've created them. – Wuhtzu May 01 '14 at 07:35
-
even I didn't use a2ensite it is still working as i expected. but to be sure I added a2ensite as what you suggested. Thanks! – user3541736 May 01 '14 at 07:41