# Cannot serve Galaxy-ng using relative path in nginx

**URL:** <https://forum.ansible.com/t/cannot-serve-galaxy-ng-using-relative-path-in-nginx/5069>\
**Category:** Get Help\
**Tags:** kubernetes, galaxy-ng\
**Created:** [April 22, 2024, 3:46pm UTC](https://forum.ansible.com/t/cannot-serve-galaxy-ng-using-relative-path-in-nginx/5069 "2024-04-22T15:46:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alonso\_Diaz\_Sobrino](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alonso_diaz_sobrino/32/2963_2.png) [@Alonso\_Diaz\_Sobrino](https://forum.ansible.com/u/Alonso_Diaz_Sobrino)\
**Post date:** [April 22, 2024, 3:46pm UTC](https://forum.ansible.com/t/cannot-serve-galaxy-ng-using-relative-path-in-nginx/5069/1 "2024-04-22T15:46:31Z")

</div>

Hi,  
I’ve installed galaxy-nx in a kubernetes environment and now i want to serve it using nginx using a relative path. For example: `http://<ip_adress>/galaxy-ng.`

I’ve tried to do this but it dind’t work. I also dind’t find any env var to do this. Can anyone teld me how to do it?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 22, 2024, 5:22pm UTC](https://forum.ansible.com/t/cannot-serve-galaxy-ng-using-relative-path-in-nginx/5069/2 "2024-04-22T17:22:17Z")

</div>

How have you deployed Galaxy-NG to your k8s environment? Did you use an operator or helm chart?

---

<div class="post-metadata">

**Author:** ![Alonso\_Diaz\_Sobrino](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alonso_diaz_sobrino/32/2963_2.png) [@Alonso\_Diaz\_Sobrino](https://forum.ansible.com/u/Alonso_Diaz_Sobrino)\
**Post date:** [April 23, 2024, 8:00am UTC](https://forum.ansible.com/t/cannot-serve-galaxy-ng-using-relative-path-in-nginx/5069/3 "2024-04-23T08:00:54Z")

</div>

I’ve deploy it manually using yml files. But the case is, how can i configure galaxy-ng app to serve it using a relative path in nginx?

I say it because before I have deployed other apps using relative path in nginx like local gitlab or apache airflow but now i cannot do it with galaxy-ng

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 23, 2024, 1:40pm UTC](https://forum.ansible.com/t/cannot-serve-galaxy-ng-using-relative-path-in-nginx/5069/4 "2024-04-23T13:40:57Z")

</div>

I’m going to first make the same recommendation that @kurokobo did.

> [@How to persist galaxy-ng data in a k8s environment?](http://forum.ansible.com/t/how-to-persist-galaxy-ng-data-in-a-k8s-environment/5070/4):
>
> Indeed it is technically possible, but a bit hard way. Even if you want to do so, first of all, I recommend you to deploy Galaxy NG by using Galaxy Operator to know what the designed setup is, where the PVCs are mounted on which pods, how configuration files for Nginx are designed, etc…

Deploying from the operator will help you see how the configuration should look in k8s to begin with.

Then you can scale down the operator, and modify the config file manually and roll the pods to pick up changes.

You’ll need to set:

```python
GALAXY_API_PATH_PREFIX = '/galaxy-ng/api/galaxy'
CONTENT_PATH_PREFIX = '/galaxy-ng/api/galaxy/pulp/api/v3/artifacts/collections/'
API_ROOT = '/galaxy-ng/api/galaxy/pulp/'
STATIC_ROOT = '/galaxy-ng/app/galaxy_ng/app/static/'

```

The above is not an exhaustive list, but the point is you will need to set every URI path related setting to account for the fact you’re placing everything under `http://<ip_address>/galaxy-ng`

You may also need to account for things like:  
`ANSIBLE_API_HOSTNAME, CONTENT_ORIGIN, CORS_ORIGIN_WHITELIST, CSRF_TRUSTED_ORIGINS, TOKEN_SERVER` among other things

That being said, I haven’t seen a `/ui/` specific path setting, so I’m not sure that the UI itself even supports relative paths.

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 23, 2024, 2:08pm UTC](https://forum.ansible.com/t/cannot-serve-galaxy-ng-using-relative-path-in-nginx/5069/5 "2024-04-23T14:08:55Z")

</div>

@Alonso_Diaz_Sobrino I think there may be a couple other options:

1. Nginx can do path rewrites, so rather than modifying all of the galaxy paths in the settings.py file, you can tell nginx to rewrite the relative paths. I don’t have any specific instructions for this though, since I haven’t done it and have a love-hate relationship with nginx configs.

2. Nginx can listen under multiple server names, so instead of changing relative paths for Galaxy-NG, you could do an alternate hostname instead. You would need to add a dns record for your nginx host (and add it to your cert if you’re doing https, or use wildcards).
