0

i am working on website, i would like to hide it from general public and search engines.

i have vps X , for hosting this site.

and another vps Y , which will be front for general public. vps Y will be used as nginx reverse proxying to vps X.

so i dont want people to know about vps X. people should not be able to access site directly by accessing vps X.

site should be only visible if people access domain name which in turn connected to vps Y.

what is the best way to achive something like this ?


edit : so far i can think of few ways.,

so far i can think of these options.

1 ) on vps X, set website on port other than 80 and do reverse proxy from vps Y to vps X:port other than 80

2 ) set cloudflare on vps X, and allow only connections which comes from clouflare.
-aparently cloudflare only works with port 80

3) on vps X, password protect website using basic http authentication. on vps Y, while doing reverse proxy pass username and password.

4) on vpx X check for special cookie, which will be set by vps Y, if cookie is found then only grant access. vps Y sets cookie to upstream server while making proxy request.

6
  • Will vps X and vps Y serve the same data to proper users?
    – jficz
    Nov 4, 2017 at 23:20
  • vps Y is just front using nginx reverse proxy. so data is actually hosted on vps X
    – user176344
    Nov 4, 2017 at 23:25
  • so what's the point? The website will not be hidden from the public as long as it's accessible publicly via vps Y.
    – jficz
    Nov 4, 2017 at 23:27
  • its for hiding webhost, on which the website is hosted and possibly hiding the server software which cant be protected using password directly. as the server software doesnt have system like that. think it like elastic search node.
    – user176344
    Nov 4, 2017 at 23:29
  • 1
    If vps x has a public IP, just firewall off everything except your front end proxy. As long as the IP is exposed, it’s discoverable, by anybody, and will be discovered. Nov 5, 2017 at 2:22

1 Answer 1

0

Simply firewall the HTTP ports on server X such that it only honours requests through serve Y.

You have not advised your OS, but its 2 lines if you can use iptables -

/sbin/iptables -I INPUT -p tcp --dport 80 -j DROP
/sbin/iptables -I INPUT -s SERVER.Y.IP --dport 80 -j ACCEPT
4
  • server X uses cloudflare for DNS. so need to whitelist cloudflare IPs
    – user176344
    Nov 5, 2017 at 3:16
  • What's DNS on server X got to do with this? DNS is a totally separate protocol. I can't see why you would need to whitelist these, but maybe I'm missing something.
    – davidgo
    Nov 5, 2017 at 3:19
  • i mean, when connecting to X using Cloudflare , wont cloudflare show every access from their IP address ? thanks. cloudflare acts as a reverse proxy.
    – user176344
    Nov 5, 2017 at 7:29
  • Don't understand what you are saying/asking (or maybe I've misunderstood what you are trying to do). Surely since the requests are going through server Y the response to the end user will come from server Y without reference to Cloufglare? (Am I correct in understanding that server X is a VPS on Cloudflares network).
    – davidgo
    Nov 5, 2017 at 7:37

You must log in to answer this question.