0

I have two different applications.

  1. Survey application built with express framework
  2. Django application using rest api and react

I would like to achieve:

vardhan.com/survey, vardhan.com/feedback, etc on survey application and

vardhan.com/ and vardhan.com/login on django application

Both routes are working in respective applications in local in different ports

Is this possible in production ?

Please let me know how to configure this in Nginx.

1 Answers1

0

If the backend for your apps running on spesific port like:

  1. Survey Apps Port 3000
  2. Django Apps Port 1000

You can use nginx proxy_pass, reff: https://linuxize.com/post/nginx-reverse-proxy/

This is just an example:

server {
        server_name vardhan.com;

        location / {
          proxy_pass http://localhost:1000; #Django
          proxy_headers_hash_max_size 512;
          proxy_headers_hash_bucket_size 64;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          add_header Front-End-Https on;
        }
        location /survey {
          proxy_pass http://localhost:3000; #Survey
          proxy_headers_hash_max_size 512;
          proxy_headers_hash_bucket_size 64;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          add_header Front-End-Https on;
        }

}

For additional information, maybe this solution will helping you : https://stackoverflow.com/a/45944752/10585581

YonzLeon
  • 311
  • 1
  • 6