run serve a set of domains in docker swarm and serve nginx sites>

I have a ubuntu 18.04 server running nginx and hosting about 6 websites.
I'm experimenting with a containerized application running in swarm mode.

I've been able to set up the swarm and deploy the application but trying to reach it from the outside gives a certificate error. I believe the request for the subdomains is being intercepted by nginix.

How can I configure nginx to serve only the traditional websites and let the swarm serve the new domains?

1 Reply

The answer to this depends on the way your websites and application are configured. Since your application itself is working within your Docker swarm, I agree that it’s likely your current web server configuration is interfering with your swarm being served. Depending on the certificate error you’re seeing and whether you’re getting web server errors as well, the recommendations in this StackOverflow post might be useful. The user in this post made some changes to their Nginx configuration files that allowed them to access their Docker service while using SSL. Another option would be to separate the application running in Docker from the rest of your sites. This would ensure that your current web server configuration isn’t interfering with or interrupted by your Docker swarm setup.

If you’d rather stick with your current configuration, it will help to have some additional information about your setup. Details like whether your application is being served on an existing domain or a new domain, along with whether there is an Nginx container within your swarm configuration, can help to narrow down the cause of this issue. For example, if you have a website being served at example.com, are you expecting your application to be served from app.example.com or from differentsite.com? If there’s a web server as part of your swarm, is your SSL certificate included in your docker-compose.yml file? What services are part of your swarm? Providing your docker-compose.yml and nginx.conf configurations (while redacting any personal details) can also help the Linode Community here get a better understanding of what may be causing the problem you’re experiencing.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct