Hosting Multiple Apps With Nginx Rewrite Rules
Suppose you plan on hosting multiple API endpoints on one domain, make it
api.your-domain.com, one way to do it is to put each endpoint under a distinctive path, each one would look like:
Configure a reverse proxy such as Nginx and set up rewrite rules can get it done quickly.
See below my example:
Depending on your Linux distro and Nginx, most would need to put the conf file under
/etc/nginx/sites-available/ directory and create a symbol link in
Restart nginx service by
sudo systemctl restart nginx ; and it’s working!