Author Topic: Aply Reverse proxy for other IP  (Read 7638 times)

0 Members and 2 Guests are viewing this topic.

Offline
*
Aply Reverse proxy for other IP
« on: September 29, 2020, 03:51:09 PM »
Hello i have a CWP in a 192.168.1.100 and i have other server with 192.168.1.101

i have the domain xxxx.com and the subdomain myapp.xxxx.com and api.xxxx.com.... how add a reverse proxy to 192.168.1.101?

i have changed the apache for apache & Nginx... i have a xxxx.com domain working in a cwp... in what file add this?


server {
  server_name myapp.mydomain.com;

  location / {
    proxy_pass http://192.168.1.101:3333;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_cache_bypass $http_upgrade;
  }
}

and

server {
  server_name api.mydomain.com;

  location / {
    proxy_pass http://192.168.1.101:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_cache_bypass $http_upgrade;
  }
}


i added this code in same files and when enter a myapp.xxxx.com and api.xxxx.com only see the TEST PAGE

Offline
*
Re: Aply Reverse proxy for other IP
« Reply #1 on: September 29, 2020, 03:53:35 PM »
Solved... it's very slow but... it's working. take much time to work.

Offline
*
Re: Aply Reverse proxy for other IP
« Reply #2 on: December 24, 2020, 10:35:56 AM »
Can I ask where about did you place this config? How did you get it working?

Offline
*
Re: Aply Reverse proxy for other IP
« Reply #3 on: December 24, 2020, 04:56:03 PM »
Hello!

there is in:

WebServer---> Settings----> WebServers COnf Editor

u need create a subdomain first (if u case of instead in a subdomain) else u need create a domain first.

after, reload nginx in dashboard!


Merry Christmas!