I've made a Javalin backend host that I've been starting on 0.0.0.0:7000 for a while now, but I recently began using Apache2 for the frontend content-serving. I was able to get apache set up, and it's running great, but now my backend won't start, with the error
Failed to bind to 0.0.0.0/0.0.0.0:80
and then later Failed to bind to 0.0.0.0/0.0.0.0:443
. How can I configure this so that both run at the same time, and I can use my backend server to handle requests to mysite.com/api/, but requests to mysite.com/ are served by apache?
You're using the SSL Plugin, if so you must configure your ports in the plugin config.
For example:
SSLPlugin plugin = new SSLPlugin(conf -> {
conf.pemFromPath("/path/to/cert.pem", "/path/to/key.pem");
conf.insecurePort = 80;
conf.securePort = 443;
// additional configuration options
});
However, since you're using Apache as a reverse proxy you might not need the SSL plugin at all, since Apache can terminate your SSL connections for you. Unencrypted traffic will only be exchanged between Apache and Javalin:
Disclaimer: I am the author of the SSL plugin