2023-09-25 16:57:47 +00:00
|
|
|
# Use Nginx as a reverse proxy
|
|
|
|
|
2024-01-02 04:11:49 +00:00
|
|
|
Configure Nginx to proxy requests to Opengist. Here are example configuration file to use Opengist on a subdomain or on a subpath.
|
|
|
|
|
|
|
|
Make sure you set the base url for Opengist via the [configuration](/docs/configuration/cheat-sheet.md).
|
|
|
|
|
|
|
|
### Subdomain
|
2023-09-25 16:57:47 +00:00
|
|
|
```
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name opengist.example.com;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_pass http://127.0.0.1:6157;
|
|
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-01-02 04:11:49 +00:00
|
|
|
### Subpath
|
|
|
|
```
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name example.com;
|
|
|
|
|
|
|
|
location /opengist/ {
|
|
|
|
rewrite ^/opengist(/.*)$ $1 break;
|
|
|
|
proxy_pass http://127.0.0.1:6157;
|
|
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header X-Forwarded-Prefix /opengist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
To apply changes:
|
2023-09-25 16:57:47 +00:00
|
|
|
```shell
|
2024-01-02 04:11:49 +00:00
|
|
|
sudo systemctl restart nginx
|
2023-09-25 16:57:47 +00:00
|
|
|
```
|