Skip to content
WJunction - Webmaster Forum

Own reverse proxy host ?

Status
Not open for further replies.
do you host your own domain? o.o
just use the DNS-Server of your service, you bought the Domain.
so you just have to point the a-record to your proxy-ip (so in this example 5.6.7.8)
delete the ns1 and ns2 that point to your server (1.2.3.4)

make sure, your website is acessable via your ip (1.2.3.4), so the proxy will work.

edit
or do it like serverpolice said.
 

28 comments

Thx much i have already done all and testing now for some clients ... I did that conf for each site as remote proxy and ait works on port like 5.6.7.8.1337 how can i add this record into domain so when someone visit site.com it will be proxied via 5.6.7.8.1337 and if someone visit 5.6.7.8.1338 the site2.com will be proxied via 5.6.7.8.1338
 
Thx much i have already done all and testing now for some clients ... I did that conf for each site as remote proxy and ait works on port like 5.6.7.8.1337 how can i add this record into domain so when someone visit site.com it will be proxied via 5.6.7.8.1337 and if someone visit 5.6.7.8.1338 the site2.com will be proxied via 5.6.7.8.1338

You talking about proxifying ports ?, as the IP (IPv4) is only of 4 segments not 5
 
see i have 2 conf for 2 sites :

site1.com conf

Code:
 server {
        listen       5.6.7.8:1337;
        server_name  site1.com;
        error_log  /var/log/nginx/error.log;
        # Main location
        location / {
            proxy_set_header   Host             site1.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;
        }
    }

site2.com conf

Code:
 server {
        listen       5.6.7.8:1338;
        server_name  site2.com;
        error_log  /var/log/nginx/error.log;
        # Main location
        location / {
            proxy_set_header   Host             site2.com;
            proxy_pass         http://9.10.12.12:80/;
            proxy_redirect     off;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
    }

when i visit site1.com it will load from 5.6.7.8:1337
when i visit site2.com it will load from 5.6.7.8:1338

but how ?
 
no.
assuming your name-server points to the right server,
you have to type
site2.com:1338 in your address-bar in Order to let it then proxyfied to 9.10.11.12:80
since you only listen to Port 1338
same for 1337

you can have two server listening at the same port - you do the determination which config will be used by the server_name property.

so just set them both to port 80 (for normal http) and it should work.
 
When you put in the address (IP or Domain) without any ports, the browser as default forwards it to the standard HTTP port i.e., 80.

If you are listening on any non-standard port (8080, 81 , 1337, 1338 [in your case]), then you would have to mention it in the address.
 
Really much thx for this support :) I got all working :)

The last question is i have domain site1.com and it point to 5.6.7.8:1337 (proxy) so i need to enter site1.com:1337 and it works but when i visit site1.com i see basic ngix page, can it be redirected to site1.com:1337 instead of showing nginx base page ? somewhere in nginx conf ?
 
Why would you want your sites to listen to a non-default port? Just make the sites listen on port 80 (so you can access it as site1.com) and then you can use a non-standard port on the back-end (proxy pass).
 
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