title: Can't serve jupyter notebook with nginx reverse proxy
body: <p>What I am trying to accomplish is to have a jupyter notebook running localhost on a VM and serve it online using nginx reverse proxy over https.</p>
  
  <p>For the moment I am trying to serve it over plain http to test that it works</p>
  
  <p>I used many configurations that I found online but it is not working.</p>
  
  <p>My nginx configuration for the moment goes like this:</p>
  
  <pre><code>server{
     listen 80;
     server_name jupyterdomain.com;
  
     location /home/user/.jupyter {
        proxy_pass http://localhost:port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;
     }
  }
  </code></pre>
  
  <p>Then I used the jupyter notebook password to create a password, which generated a JSON file with the hash key, which I copied into the jupyter_notebook_config.py file</p>
  
  <p>In the jupyter_notebook_config.py file I have the following configurations:</p>
  
  <pre><code>c.NotebookApp.allow_origin = '*'
  c.NotebookApp.allow_root = False
  c.NotebookApp.base_url = 'jupyterdomain.com'
  c.NotebookApp.ip = '127.0.0.1'
  c.NotebookApp.notebook_dir = u'/home/user/.jupyter'
  c.NotebookApp.open_browser = False
  c.NotebookApp.password = u'sha1:passwordhash'
  c.NotebookApp.password_required = True
  c.NotebookApp.port = port
  c.NotebookApp.port_retries = 50
  </code></pre>
  
  <p>When starting jupyter notebook it seems to be running fine with the following message:</p>
  
  <pre><code>[I 15:35:22.626 NotebookApp] Serving notebooks from local directory: /home/user/.jupyter
  [I 15:35:22.626 NotebookApp] 0 active kernels
  [I 15:35:22.626 NotebookApp] The Jupyter Notebook is running at:
  [I 15:35:22.626 NotebookApp] http://127.0.0.1:port/jupyterdomain.com/
  [I 15:35:22.627 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
  </code></pre>
  
  <p>So the problem is that jupyterdomain.com serves the nginx welcome page.</p>
  
  <p>I don't know what I am missing, it could be a nginx configuration or jupyter configuration. Maybe I didn't install jupyter properly? Like wrong path or something. </p>
  
  <p>Note that I didn't use anacoda, I only used pip and python 2.7 ( which is the version that I want jupyter to run on)</p>
  
  <p>Thanks in advance for any suggestion.</p>
  
  <p>EDIT: Trying to access notebook from my local pc via ssh tunneling is successfull but only using:</p>
  
  <p>"localhost:port/jupyterdomain.com" on the browser.</p>
  
  <p>Not on localhost:port</p>