ROODAY
ROODAY

Reputation: 832

How to allow websockets to specific subdomain behind an nginx proxy?

I have a Digital Ocean server running Ubuntu 14.04, and two web applications running through Docker containers. One is a Ghost container, the other is a Jupyter container (https://hub.docker.com/r/jupyter/notebook/). I'm also running an nginx-proxy container (https://github.com/jwilder/nginx-proxy).

The issue is that websockets aren't working, and Jupyter requires them to be enabled to work. I have Jupyter served at http://notes.rooday.com/, and accessing it works, but it can't connect to the ipython kernel due to the disabled websockets. I tried researching how to fix this, and the closest I got was this nginx config file https://paste.ubuntu.com/5620850/.

However, I'm not sure how to apply that config file to the nginx-proxy container, especially in a way that will not interfere with my Ghost container which is also behind the nginx-proxy (at http://blog.rooday.com/).

Can someone point me in the right direction?

Upvotes: 2

Views: 2333

Answers (2)

ROODAY
ROODAY

Reputation: 832

Forgot to edit this, as I found the true issue going on (Andy Shinn was correct that it was not a configuration issue).

The actual problem was not any of my docker containers or even anything in the Digital Ocean server itself, but rather an issue with Cloudflare. Cloudflare does not yet support Websockets, so any domains that make use them have to be grey-clouded in the Cloudflare DNS panel.

Reference

Upvotes: 1

recoup8063
recoup8063

Reputation: 4280

It sounds like what you want to do is add a custom Nginx configuration file for only one Virtual Host in the jwilder/nginx-proxy container.

According to the jwilder/nginx-proxy container documentation1 you have to mount a volume which has your Nginx configuration file in it. To do this add the following to your docker run command

-v /path/to/vhost.d:/etc/nginx/vhost.d:ro

Then on your machine in /path/to/vhost.d make a file called notes.rooday.com and add your custom Nginx configuration.


  1. All the way at the at the bottom, Header: "Custom Nginx Configuration.Per-VIRTUAL_HOST"

Upvotes: 2

Related Questions