mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	chore(docs): update Nginx documentation
This commit is contained in:
		
							parent
							
								
									e39c65692e
								
							
						
					
					
						commit
						b4a5f95eb3
					
				@ -48,9 +48,11 @@ Configure Nginx proxy and HTTPS. The operating system here is Ubuntu 18.04.
 | 
				
			|||||||
        return 301 https://$server_name$request_uri;
 | 
					        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:
 | 
					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.
 | 
					    *   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 {
 | 
					        location /trilium/instance-one {
 | 
				
			||||||
            proxy_set_header Host $host;
 | 
					            proxy_set_header Host $host;
 | 
				
			||||||
 | 
				
			|||||||
@ -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
 | 
					        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
 | 
					# This part is for HTTPS forced
 | 
				
			||||||
server {
 | 
					server {
 | 
				
			||||||
            listen 80;
 | 
					    listen 80;
 | 
				
			||||||
            server_name trilium.example.net; # change to your domain
 | 
					    server_name trilium.example.net; # change to your domain
 | 
				
			||||||
            return 301 https://$server_name$request_uri;
 | 
					    return 301 https://$server_name$request_uri;
 | 
				
			||||||
}</code></pre>
 | 
					}</code></pre>
 | 
				
			||||||
  </li>
 | 
					  </li>
 | 
				
			||||||
 | 
					  <li>
 | 
				
			||||||
 | 
					    <p>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:</p>
 | 
				
			||||||
 | 
					    <ul>
 | 
				
			||||||
 | 
					      <li>update the location with your desired path (make sure to not leave a trailing
 | 
				
			||||||
 | 
					        slash "/", if your <code>proxy_pass</code> does not end on a slash as well)</li>
 | 
				
			||||||
 | 
					      <li>add the <code>proxy_cookie_path</code> directive with the same path: this
 | 
				
			||||||
 | 
					        allows you to stay logged in at multiple instances at the same time.</li>
 | 
				
			||||||
 | 
					    </ul><pre><code class="language-text-x-trilium-auto">    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
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					</code></pre>
 | 
				
			||||||
 | 
					  </li>
 | 
				
			||||||
</ol>
 | 
					</ol>
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user