Domain and subdomain setup using nginx

I’m pretty new to Docker and have much to learn, so apologies in advance if this is a bit of a newbie question.

I’ll try to be as brief and concise as possible.

On my dedicated server, I currently have apache hosting a wordpress site on mysite .com and https:// www. mysite. com/, using LetsEncrypt and MariaDB on the host. The plan was to also get a Nextcloud server https: //cloud. mysite. com/ running using Docker (database, nginx/apache all in containers).

I pretty much followed this guide using this docker-compose file, which uses a reverse proxy server and automatically generates LetsEncrypt certificates.

Now, this only works if I disable apache on my host, because it’s already using port 80 (and 443 I presume). So after stopping apache on my host OS and running the docker-compose file , the docker containers all run fine and spin up my Nextcloud site on https:// cloud.mysite. com, but I’ve lost my wordpress site that was running on https:// mysite. com because I’ve had to stop the apache service.

What are my options? Should I migrate my server’s apache config (the wordpress site) to a docker container and use virtual hosts to run both sites?

Or can I keep my current setup and run the containerized cloud .mysite.com site alongside my host’s mysite. com site using different ports? If so, how would I do that?

I just need some ideas or need to be pointed in the right direction, if possible.

Much appreciated.

PS links in the post are broken up because the amount of hyperlinks is limited as a new forum user.

You should be able to expose the nginx service on a different port and just reverse proxy it using apache.

Your other option is to containerize your Wordpress setup as well and use the nginx service as a frontend to both apps.