0

currently I have my main website running in a droplet. My domain https://example.com has an A record pointing to the ip of the droplet and in the droplet I'm using nginx-proxy with the VIRTUAL_HOST variable of the domain.

Now, I would like to access one whole different application hosted in another droplet through the url https://example.com/myapp

I know I could use the same logic above using a subdomain https://myapp.example.com pointing to the ip of this new droplet, but I really would like to use the url https://example.com/myapp

How can I accomplish this? Is that possible at all?

Gerald Schneider
  • 26,582
  • 8
  • 65
  • 97
Falcoa
  • 117

1 Answers1

1

You would use the "reverse proxy" functionality of the Nginx http_proxy_module on the server handling your domain example.com to map the URL path "/myapp" to the second droplet.

In its most simple form that is with the proxy_pass directive:

location /myapp/ {
     proxy_pass http://ip-or-hostname-of-other-droplet/myapp/;
}

but depending on the internal functionality of your app you may need to use one or more of the additional directives the module provides or jump though even more hoops to get the application to work correctly.

MadHatter
  • 81,580
HBruijn
  • 84,206
  • 24
  • 145
  • 224