From b4a5f95eb3ed403d74af1323c51cbeef5440fdb9 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 13 Apr 2025 17:11:02 +0300 Subject: [PATCH] chore(docs): update Nginx documentation --- .../2. Reverse proxy/Nginx.md | 18 ++++++----- .../2. Reverse proxy/Nginx.html | 32 ++++++++++++++++--- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.md index 3db7ec813..df8c1ab10 100644 --- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.md +++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.md @@ -1,4 +1,4 @@ -# Nginx +# Nginx Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04. 1. Download Nginx and remove Apache2 @@ -14,7 +14,7 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04. vim default.conf ``` 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. - + ``` # This part is for proxy and HTTPS configure server { @@ -27,7 +27,7 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04. ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; #check the path of access.log, if it doesn't fit your file, change it - + location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -40,7 +40,7 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04. proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain } } - + # This part is for HTTPS forced server { listen 80; @@ -48,9 +48,11 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04. return 301 https://$server_name$request_uri; } ``` -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: - * 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) - * add the `proxy_cookie_path` directive with the same path: this allows you to stay logged in at multiple instances at the same time. +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: + + * 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) + * add the `proxy_cookie_path` directive with the same path: this allows you to stay logged in at multiple instances at the same time. + ``` location /trilium/instance-one { proxy_set_header Host $host; @@ -64,5 +66,5 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04. proxy_read_timeout 90; proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain } - + ``` \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.html b/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.html index 3ff97eb6a..46ac6f4fb 100644 --- a/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.html +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Nginx.html @@ -21,7 +21,7 @@ server { ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; #check the path of access.log, if it doesn't fit your file, change it - + location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -34,11 +34,35 @@ server { proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain } } + # This part is for HTTPS forced server { - listen 80; - server_name trilium.example.net; # change to your domain - return 301 https://$server_name$request_uri; + listen 80; + server_name trilium.example.net; # change to your domain + return 301 https://$server_name$request_uri; } +
  • +

    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:

    +
        location /trilium/instance-one {
    +        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 Upgrade $http_upgrade;
    +        proxy_set_header Connection "upgrade";
    +        proxy_pass http://127.0.0.1:8080; # change it to a different port if non-default is used
    +        proxy_cookie_path / /trilium/instance-one
    +        proxy_read_timeout 90;
    +        proxy_redirect http://127.0.0.1:8080 https://trilium.example.net; # change them based on your IP, port and domain
    +    }
    +
    +
  • \ No newline at end of file