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

Posted May 23, 2016 3.4k views
Linux BasicsNginxCentOSSecurityNetworkingSystem ToolsVPNJava

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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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.