Skip to content
WJunction - Webmaster Forum

Own reverse proxy host ?

Status
Not open for further replies.
So i am asking how can i do own reverse proxy host ? i mean via nameservers.

So like site.com has IP - 1.2.3.4 and in nameservers which has offshore host has IP - 5.6.7.8 and inside those nameservers will be hidden original IP of site.com 1.2.3.4 it is possible ? if so how pls :)
 

28 comments

No only possible way is to process all requests through 5.6.7.8 which would need nginx or lighttpd or even apache to produce a frontend server.
 
With nameservers you can't hide your IP as you would have to create an A record to the webserver .., you need to setup a webserver as reverse proxy to forward the request and point the A record there.

So your site on IP 1.2.3.4 will become 5.6.7.8, with custom nameservers too.
 
so the same i want to do to hide original server ip 1.2.3.4 and becomes 5.6.7.8 as cloudflare does, how via nginx its possible ? since CF using nginx too ...
 
Yes it is possible .., I use the same system to load balance and proxify a couple of our clients websites, With our own infrastructure (servers).
 
The vhost should go like this

Code:
  upstream example {
    server IP_OF_SERVER_TO_BE_HIDDEN1;
    server IP_OF_SERVER_TO_BE_HIDDEN2; //2nd is not necessary it's for load balancing - if you have websites on 2 servers and want to divide traffic between them
  }

server {
    listen       IP_OF_PROXY_SERVER:80;
    server_name  YOUR_DOMAIN.com;

## Do not edit below this line unless you understand what all the variables mean ##

    access_log  /var/log/nginx/access.log  main;
    error_log  /var/log/nginx/error.log;
    root   /usr/share/nginx/html;
    index  index.html index.htm;

    
    location / {
     proxy_pass  http://example;
     proxy_next_upstream error timeout invalid_header http_500 http_502 http_50$
     proxy_redirect off;
     proxy_buffering off;
     proxy_set_header        Host            $host;
     proxy_set_header        X-Real-IP       $remote_addr;
     proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
   }
}

This is nginx as reverse proxy + load balancer
 
Last edited:
thx for helping :)

ok so in my case is 10.10.61.1:80 this one 5.6.7.8:80 right ?

proxy_pass http://example is in my case site site.com with ip 1.2.3.4 (original ip not proxified)

what part i dont understand is this one upstream example {server 10.10.61.210;server 10.10.61.265;} whats that ?
 
You can no name based virtual hosting (its actually something we support). Although only with HTTP and not HTTPS or TCP/UDP raw. But since you are only talking with nginx you are limited to HTTP/HTTPS anyway.
 
okay so i got one offshore vps with nginx installed.

Original unhidden server -> site.com has IP - 1.2.3.4
Proxy nginx offshore server -> has IP (no domain name) - 5.6.7.8

So now what to edit to works as if i visit site.com it become proxied server 5.6.7.8
 
okay so i got one offshore vps with nginx installed.

Original unhidden server -> site.com has IP - 1.2.3.4
Proxy nginx offshore server -> has IP (no domain name) - 5.6.7.8

So now what to edit to works as if i visit site.com it become proxied server 5.6.7.8

Set your domain to point to 5.6.7.8

create a new nginx-config file. (e.g. in etc/nginx/conf.d/ (this should be the standard) and name it whatever you want)

add s.th. like this in the new file:
Code:
 server {
        listen       5.6.7.8:80;
        server_name  yourdomain.com;
        error_log  /var/log/nginx/error.log;
        # Main location
        location / {
            proxy_set_header   Host             yourdomain.com;
            proxy_pass         http://1.2.3.4:80/;
            proxy_redirect     off;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
    }

for more infos also try to edit the code that ServerPolice has posted.
 
i understand proxy server (5.6.7.8) but i dont understand what to change in server 1.2.3.4 (how to point it to that 5.6.7.8, i have no nameserver of 5.6.7.8 only that ip)

//correct me if i am wrong. i have ns1.site.com and ns2.site.com which has now ip (no proxy) 1.2.3.4 so i just change those ips to 5.6.7.8 ?
 
Status
Not open for further replies.

About the author

A
Active Member · Joined
185
Messages
51
Reactions
28
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom