Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 1952d94

Browse files
committed
docs(reverse_proxy): add info about proxy_cookie_path
1 parent c3fec95 commit 1952d94

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

  • docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy

docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Nginx
1+
# Nginx
22
Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.
33

44
1. Download Nginx and remove Apache2
@@ -14,7 +14,7 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.
1414
vim default.conf
1515
```
1616
3. Fill the file with the context shown below, part of the setting show be changed. Then you can enjoy your web with HTTPS forced and proxy.
17-
17+
1818
```
1919
# This part is for proxy and HTTPS configure
2020
server {
@@ -27,7 +27,7 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.
2727
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
2828
ssl_prefer_server_ciphers on;
2929
access_log /var/log/nginx/access.log; #check the path of access.log, if it doesn't fit your file, change it
30-
30+
3131
location / {
3232
proxy_set_header Host $host;
3333
proxy_set_header X-Real-IP $remote_addr;
@@ -40,10 +40,29 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.
4040
proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain
4141
}
4242
}
43+
4344
# This part is for HTTPS forced
4445
server {
45-
listen 80;
46-
server_name trilium.example.net; # change to your domain
47-
return 301 https://$server_name$request_uri;
46+
listen 80;
47+
server_name trilium.example.net; # change to your domain
48+
return 301 https://$server_name$request_uri;
4849
}
50+
```
51+
4. Alternatively if you want to serve the instance under a different path (useful e.g. if you want to serve multiple instances), update the location block like so:
52+
* update the location with your desired path (make sure to not leave a trailing slash "/", if your `proxy_pass` does not end on a slash as well)
53+
* add the `proxy_cookie_path` directive with the same path: this allows you to stay logged in at multiple instances at the same time.
54+
```
55+
location /trilium/instance-one {
56+
proxy_set_header Host $host;
57+
proxy_set_header X-Real-IP $remote_addr;
58+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
59+
proxy_set_header X-Forwarded-Proto $scheme;
60+
proxy_set_header Upgrade $http_upgrade;
61+
proxy_set_header Connection "upgrade";
62+
proxy_pass http://127.0.0.1:8080; # change it to a different port if non-default is used
63+
proxy_cookie_path / /trilium/instance-one
64+
proxy_read_timeout 90;
65+
proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain
66+
}
67+
4968
```

0 commit comments

Comments
 (0)