Setting up an nginx reverse proxy server for SSL connections on a remote virtual machine, with Apache tomcat

Update: I had been having various problems with my ancient Centos 7 install, so I set up a new virtual machine running Centos 8 Stream. On this new machine I have installed Apache tomcat and nginx.

I can now use the SSL certificates from Letsencrypt: my domain uses SSL. The problem now is that the page resolves to a default html page from nginx, not to the Apache tomcat server.

This is the default index.html page that is distributed with nginx on Red Hat Enterprise Linux. It is located in /usr/share/nginx/html.

You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.

I don't really understand the nginx configuration procedure, and the various online guides seem to deal with different versions. If I create an additional configuration file, in /etc/nginx/conf.d/coanzse.conf or similar, it inevitably results in an nginx error: either the "address is already in use", the "location" has already been defined, or something similar. Googling these error messages didn't turn up any quick fixes.

If anyone has a working nginx reverse proxy using tomcat and can help out I would be very thankful!