# Cannot use nginx proxy

**URL:** <https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353>\
**Category:** 🔒 Gradio\
**Created:** [April 21, 2023, 1:08pm UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353 "2023-04-21T13:08:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuqiang](https://avatars.discourse-cdn.com/v4/letter/f/f04885/32.png) [@fuqiang](https://discuss.huggingface.co/u/fuqiang)\
**Post date:** [April 21, 2023, 1:08pm UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/1 "2023-04-21T13:08:32Z")

</div>

Hello everyone

I use nginx to proxy gradio app, for example, [https://ip](https://ip):port/chat/ agent [http://127.0.0.1/](http://127.0.0.1/) Can’t find theme.css, can’t join websocket. How do I set it up

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [April 21, 2023, 8:51pm UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/2 "2023-04-21T20:51:14Z")

</div>

please look at this live example, using Nginx with Gradio

> **[nginx.conf · radames/nginx-gradio-reverse-proxy at main](https://huggingface.co/spaces/radames/nginx-gradio-reverse-proxy/blob/main/nginx.conf)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> **[Nginx Gradio Reverse Proxy - a Hugging Face Space by radames](https://huggingface.co/spaces/radames/nginx-gradio-reverse-proxy)**
>
> Discover amazing ML apps made by the community

---

<div class="post-metadata">

**Author:** ![timiil](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@timiil](https://discuss.huggingface.co/u/timiil)\
**Post date:** [July 7, 2023, 4:34pm UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/3 "2023-07-07T16:34:25Z")

</div>

hello , your sample can proxy gradio in a root path ‘/’, but it is failed to proxy in a path like ‘/blabla’, the page is blank. do you have any idea to make this OK ?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [July 7, 2023, 4:37pm UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/4 "2023-07-07T16:37:19Z")

</div>

do you have any route serving on `/` the Space manager needs something on `/` in order to successfully load

---

<div class="post-metadata">

**Author:** ![timiil](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@timiil](https://discuss.huggingface.co/u/timiil)\
**Post date:** [July 7, 2023, 4:45pm UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/5 "2023-07-07T16:45:33Z")

</div>

do you mean the websocket ? i saw the websocket connection request is coming to the ‘/’ path, is it some way to fix this ?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [July 7, 2023, 5:50pm UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/6 "2023-07-07T17:50:19Z")

</div>

can you please share you nginx.conf?

---

<div class="post-metadata">

**Author:** ![timiil](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@timiil](https://discuss.huggingface.co/u/timiil)\
**Post date:** [July 8, 2023, 12:02am UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/7 "2023-07-08T00:02:23Z")

</div>

here is my nginx.conf which flow by your example , it is work.

```auto

...
server {
                                                listen 8000;
                        server_name somedomain 192.168.1.200;

#location / {
# root /usr/share/nginx/html;
# index index.html;
# }

                location / {

proxy_pass http://192.168.1.253:7860;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        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_cache_bypass $http_upgrade;
        proxy_read_timeout 86400;
        proxy_redirect off;

                }

        }

```

here is the folder path version which FAILED:

```auto
location /test {

proxy_pass http://192.168.1.253:7860;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        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_cache_bypass $http_upgrade;
        proxy_read_timeout 86400;
        proxy_redirect off;

                }

        }

```

it is failed by not show the web ui, instead show up the json result “not found”  
 ![图片](https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f201d76bf625fd1761806fe3b79bb8c18377542.png)

---

<div class="post-metadata">

**Author:** ![cloudbooklet](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cloudbooklet/32/17643_2.png) [@cloudbooklet](https://discuss.huggingface.co/u/cloudbooklet)\
**Post date:** [July 15, 2023, 1:50am UTC](https://discuss.huggingface.co/t/cannot-use-nginx-proxy/37353/8 "2023-07-15T01:50:28Z")

</div>

Maybe this could help someone to configure [reverse proxy for Gradio](https://www.cloudbooklet.com/draggan-ai-editing-tool/#nginx-configuration-for-gradio-optional).
