A
A
Acidter2016-05-02 23:34:13
Python
Acidter, 2016-05-02 23:34:13

How to replace server:8888 with server/jupyter using nginx?

Good day.
Jupyter is running on port 8888 on the home server.
Also back-end Apache web server on port 8080 and Nginx proxying it on port 80.
How can I redirect Nginx to Jupyter so that the Jupyter link is server/jupyter instead of server:8888 ?
Tried to do it, but gives 404 error.
Here is the part of my nginx.conf config file with redirects:

upstream ipy {
        server 127.0.0.1:8888;
    }

    server {
        listen       80;
        server_name  localhost;
       # Apache
        location / {
                proxy_pass http://127.0.0.1:8080/;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_connect_timeout 120;
                proxy_send_timeout 120;
                proxy_read_timeout 180;
        }
        # Jupyter
        location /jupyter {
                proxy_pass http://ipy;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_connect_timeout 120;
                proxy_send_timeout 120;
                proxy_read_timeout 180;
                proxy_set_header Origin "";
        }

If you comment out location for Apache, and for Jupyter set location / instead of location /jupyter , you can get to the service at server. But in this case, everything that works through Apache is not available.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Ergil Osin, 2016-05-03
@Ernillew

upstream ipy {
        server 127.0.0.1:1488;
    }

Nothing bothers you? You are our Heil-Hitlerite.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question