# Deploying notebook with nginx and voila on a different port than 80

**URL:** <https://discourse.jupyter.org/t/deploying-notebook-with-nginx-and-voila-on-a-different-port-than-80/10440>\
**Category:** General\
**Tags:** help-wanted\
**Created:** [August 20, 2021, 4:57pm UTC](https://discourse.jupyter.org/t/deploying-notebook-with-nginx-and-voila-on-a-different-port-than-80/10440 "2021-08-20T16:57:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mesonepigreco](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mesonepigreco/32/5034_2.png) [@mesonepigreco](https://discourse.jupyter.org/u/mesonepigreco)\
**Post date:** [August 20, 2021, 4:57pm UTC](https://discourse.jupyter.org/t/deploying-notebook-with-nginx-and-voila-on-a-different-port-than-80/10440/1 "2021-08-20T16:57:20Z")

</div>

Dear community,  
I’m trying to deploy a jupyter-notebook on a private server using voila and nginx.

My configuration file for nginx is:

```auto
server {
    listen 1234;
    proxy_buffering off;
	      
     location / {
	    proxy_pass http://localhost:8869;

            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 86400;
	      }

	      
	      
    client_max_body_size 100M;
    error_log /var/log/nginx/error.log;
}

```

And I run the my jupyter notebook as:

```auto
voila ComputeEntropy_sub.ipynb --port=8869 --no-browser &

```

If I change the nginx configuration to listen at port 80 and connect to localhost, everything works. However if I change the listen port of nginx as in the example and connect to localhost:1234, the ipywidgets do not display in the notebook (only static markdown is rendered). Indeed, if I connect to localhost:8869 everything works.

The voila output does not show any error, while the nginx error log reports:

```auto
2021/08/20 18:12:54 [error] 25970#25970: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8869/", host: "localhost:1234"

```

How can I make it work correctly?

---

<div class="post-metadata">

**Author:** ![mesonepigreco](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mesonepigreco/32/5034_2.png) [@mesonepigreco](https://discourse.jupyter.org/u/mesonepigreco)\
**Post date:** [August 27, 2021, 5:52pm UTC](https://discourse.jupyter.org/t/deploying-notebook-with-nginx-and-voila-on-a-different-port-than-80/10440/2 "2021-08-27T17:52:55Z")

</div>

I found the solution.  
I post it since it may be useful to other people.  
Voila and Jupyter do not trust by default connection coming from a port different either from 80 or from the port they are running.  
Thus if there is a port-forwarding configuration, to get everything running correctly one must tell voila (and jupyter) to trust all connections:

I added this in the command to start voila:

```auto
voila ComputeEntropy_sub.ipynb --port=8869 --no-browser --Voila.tornado_settings="{'allow_origin': '*'}" &

```
