What is the best way secure traffic from one droplet running NGINX as a reverse-proxy to tomcat on another droplet over 'private' network?

May 23, 2016 2.5k views
VPN Nginx Security CentOS Networking System Tools Java Linux Basics

Currently, I’m using the latest CentOS, but is not really a CentOS question.

Droplet A:
NGINX acting as a reverse proxy serves https requests

Droplet B:
Apache Tomcat (my java web server) running on port 80.

Historically when I was not on Digital Ocean, I had physical security and I connected over port 80 between my backend servers

At Digital Ocean, there is not a true ‘private’ network. Only private within Digital Ocean’s thousands of clients.

Some people have mentioned the following:

  1. IPSec using Strong Swan or something similar
  2. Using Tomcat’s cryptography (I’m not sure how fast java is at cryptography)
  3. SSL Tunneling (We’ve used autossh for less critical things, but doesn’t feel right here)
  4. Running NGINX in front of the tomcat. (Installling another NGINX instance on Droplet B in front of tomcat)

What is the best way to secure and not compromise performance?

1 Answer

Any of these options should work. #4 would likely be the easiest to implement if you have not previously worked wit Tomcat’s cryptography. I have no data to back this up but 2 and 3 would likely be the fastest but #4 would provide the option for a cache if it would provide any value in your configuration.

  • Thanks Ryan. What are your thoughts on IPSec?

    • Overall I think it’s a good option but it may also be the most complicated of those you mentioned. In general if you can get https enabled on your tomcat droplet you will have encrypted communications without having as much to configure.

Have another answer? Share your knowledge.