Hosting two domains on a VPS while preventing an attacker from finding domain A given domain B?
I would like to host two websites on a VPS. One of them is my portfolio. The other one is a gaming website. I don't want an attacker to find my portfolio domain name if they know my gaming domain name. How can I do this?
You cannot prevent it, but you can make it more difficult.
If both are running on the same IP address, one obvious approach for an outsider knowing one domain name wanting to know if there are others is to use reverse DNS.
If reverse DNS gives all of the domain names associated with the host, then knowing any of them would allow resolving all of them through reverse DNS. But you can configure reverse DNS to hand only one, which you don't mind people knowing about. That could be the domain of one of the websites or even a different domain name resolving to your host but for which you don't have a website.
Keep in mind that if you are sending emails from the server, then receiving mail servers may put requirements on your reverse DNS records that you must satisfy before they will receive mail from you.
But if your domain name is publicly known, chances are there will be other websites telling both hostname and IP address. Hence knowing the IP address, you would be likely to find many of the websites hosted on it, by simply searching for the IP address in a search engine.
You also have to pay attention to banners that may identify the hostname in any of the services that you run on the server. For example if you receive emails on the server, check what hostname the mail server presents itself with. And pay attention to what hostname is shown to users who access the default vhost on your webserver.