Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Nginx Reverse Proxy
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Nginx Reverse Proxy

stasistasi Member
edited September 2016 in Help

Hey leb-ians,

I am having a little problem with setting up my first rproxy.

I am trying to put a ddos protected vps infront of a unprotected one.

my setup:
-domain.com (points to IP_Adress_2, https letsencrypt)

-vps1 (unprotected, IP_Adress_1, lemp)

-vps2 (ddos protected, IP_Adress_2, nginx)

this my /etc/nginx/conf.d/default.conf on vps2:

 server {
 listen       IP_Adress_2;
 server_name  domain.com www.domain.com;
 rewrite ^(.*) https://domain.com$1 permanent;

 access_log  off;
 error_log  off;
 root   /usr/share/nginx/html;
 index  index.html index.htm;


 location / {
 proxy_pass  https://IP_Adress_1;
 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
 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;

}

}

can you please help me out :(

Comments

  • first part seems very much looping itself... you probably need to separate into twi different blocks.

    one block listening to port 80 for non-ssl requests, where might put your rewrite to https

    and another listening on port 443 for ssl request, which also would need to have ssl on declared and path to your certificate etc.

  • "I am having a little problem" -> what's the problem?

Sign In or Register to comment.