# How to set up a NGINX Reverse Proxy that is hosting the Galaxy server?

**URL:** <https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447>\
**Category:** Uncategorized\
**Tags:** devops-administration, proxy\
**Created:** [September 14, 2020, 4:00pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447 "2020-09-14T16:00:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamGG](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/samgg/32/49_2.png) [@SamGG](https://help.galaxyproject.org/u/SamGG)\
**Post date:** [September 14, 2020, 4:00pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447/1 "2020-09-14T16:00:16Z")

</div>

Hi,  
I want to have the Galaxy production server in the intranet behind a Nginx server that is connected to the internet.  
I didn’t find any information about that topic apart from a few unanswered questions.  
Possible or taboo?  
Best,  
Samuel

---

<div class="post-metadata">

**Author:** ![mvdbeek](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/mvdbeek/32/110_2.png) [@mvdbeek](https://help.galaxyproject.org/u/mvdbeek)\
**Post date:** [September 14, 2020, 4:02pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447/2 "2020-09-14T16:02:57Z")

</div>

Definitely possible and should not be different from any other reverse proxy setup. Are there any specific issues you’ve encountered ?

---

<div class="post-metadata">

**Author:** ![SamGG](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/samgg/32/49_2.png) [@SamGG](https://help.galaxyproject.org/u/SamGG)\
**Post date:** [September 14, 2020, 7:00pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447/3 "2020-09-14T19:00:36Z")

</div>

Thanks for the interest.

I got a white page (not an error), but its source code contains mainly javascript that shows nothing.

Here is the current basic configuration within debian

```
server {
  listen 80;
  location / {
    return 301 http://the_institute_URL;
  }
  location /galaxy/ {
    include proxy_params;
    proxy_pass http://10.36.10.49:8080/;
  }
}

```

The proxy\_params file contains

```
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

```

It would be good if you could come up with a solution.  
Best.

NB: currently I am trying to a testing Galaxy instance, ie a simple instance manually launched with sh run.sh. I don’t know if this could make a difference.

---

<div class="post-metadata">

**Author:** ![dannon](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/dannon/32/74_2.png) [@dannon](https://help.galaxyproject.org/u/dannon)\
**Post date:** [September 14, 2020, 7:16pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447/4 "2020-09-14T19:16:54Z")

</div>

I see you’re serving galaxy at the prefix /galaxy here. Do you have the same mapping on the galaxy side?

You’ll need to set the `mount` and `manage-script-name` options in your galaxy.yml configuration file. The other thing that would be useful to see is the full network request log from your browser’s developer tools – that would help validate that it’s requesting the javascript client files from the wrong address.

---

<div class="post-metadata">

**Author:** ![SamGG](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/samgg/32/49_2.png) [@SamGG](https://help.galaxyproject.org/u/SamGG)\
**Post date:** [September 14, 2020, 7:20pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447/5 "2020-09-14T19:20:32Z")

</div>

Good point, the serving point in the testing instance is /, not /galaxy.  
I am going to update the testing instance as I want to keep the prefix.  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![SamGG](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/samgg/32/49_2.png) [@SamGG](https://help.galaxyproject.org/u/SamGG)\
**Post date:** [September 14, 2020, 9:38pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447/6 "2020-09-14T21:38:26Z")

</div>

Here I am trying to define the prefix of an instance launched by “run.sh”. I didn’t find any clear “prefix” nor “URL” option, but Dannon’s advice works perfectly. So I succeeded in getting the galaxy interface at localhost:8080/galaxy/ while launching “run.sh”. Then, I updated the configuration of the proxy server to point it to the new URL with the galaxy prefix.

Here is my final configuration to set /galaxy at the proxy server and at the galaxy instance (whose ip address is 10.36.10.49).

I changed the following lines in config.yml as pointed by Dannon.

```
#module: galaxy.webapps.galaxy.buildapp:uwsgi_app()
mount: /galaxy=galaxy.webapps.galaxy.buildapp:uwsgi_app()
manage-script-name: true

```

nginx config

```
server {
  listen 80;
  location / {
    return 301 http://the_institute_URL;
  }
  location /galaxy/ {
    include proxy_params;
    proxy_pass http://10.36.10.49:8080/galaxy/;
  }
}

```

During testing, I used the static part of Galaxy for checking that the communication is OK between servers. If I ask for /galaxy/static/welcome.html, I got the static “middle” page of the interface. So it sounds as if it’s OK to serve static content.

I didn’t run any analysis yet, only the interface. More on that tomorrow.

Thanks guys.

---

<div class="post-metadata">

**Author:** ![SamGG](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/samgg/32/49_2.png) [@SamGG](https://help.galaxyproject.org/u/SamGG)\
**Post date:** [September 16, 2020, 9:17pm UTC](https://help.galaxyproject.org/t/how-to-set-up-a-nginx-reverse-proxy-that-is-hosting-the-galaxy-server/4447/7 "2020-09-16T21:17:12Z")

</div>

Tested with concurrent. OK.  
To be noticed: while the galaxy instance is linked to /galaxy as stated in galaxy.yml, it still serves /. I mean onthe intranet server, not on the internet proxy.
