Skip to end of metadata
Go to start of metadata

At Ampath we have many systems that work separately but need to be accessed simultaneously sometimes. A good example is the amrs rest services and the etl rest server which are needed by the poc system. Challenges arise when this systems are hosted on port or different domains. To solve some of this challenges we can setup a reverse proxy so that we can access this systems as if the were a sing system hosted on on the same domain. In this case we shall be using nginx and assuming Ubuntu as the OS.

$ sudo apt-get install nginx

$cd /etc/nginx/sites-available/

$sudo nano poc.conf

 

with this content similar to this

server { listen 80;
server_name poc;
access_log /var/log/poc/nginx.access.log;
error_log /var/log/poc/nginx.error.log;
root /var/www/poc;
charset utf-8;

 

location /amrs {
rewrite ^/amrs/(.*) /$1 break;
proxy_redirect off;
proxy_pass http://188.166.160.139:8080/amrs;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Authorization $http_authorization;
}

location /etl {
rewrite ^/etl/(.*) /$1 break;
proxy_redirect off;
proxy_pass http://188.166.160.139:8002/etl;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Authorization $http_authorization;
}
location / {
try_files $uri /index.html;
}
}

$ sudo ln -s /etc/nginx/sites-available/poc.conf /etc/nginx/sites-enabled/poc.conf

$ sudo service nginx restart

 

 

  • No labels

1 Comment

  1. you could also add caching to the nginx server. 

    i think i will help with the number of requests going to the server.