nginx.adoc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. [#nginx-dns]
  2. = Nginx
  3. include::partial$reverse-proxies/diagram.adoc[]
  4. This is an example of DNS based proxying with Nginx.
  5. The example uses `http2 on;`, which requires Nginx 1.25.1 or later with `ngx_http_v2_module`. On older Nginx versions, replace it with `listen 443 ssl http2;` and remove the separate `http2` directive.
  6. ./etc/nginx/cond.d/OliveTin.conf
  7. [source,nginx]
  8. ----
  9. include::example$reverse-proxies/etc/reverse_proxy_nginx_dns.conf[]
  10. ----
  11. Increase the proxy timeout for the websocket location so the reverse proxy does not close long-lived connections; see xref:troubleshooting/err-websocket-connection.adoc#reverse-proxies-will-close-websockets[Reverse proxies will close websockets] if you see disconnects.
  12. [#nginx-path]
  13. == Custom paths
  14. These "custom path" instructions are for when you want to use OliveTin with a custom path like "apps.example.com/olivetin" instead of the root path + DNS name - eg: "olivetin.example.com". Generally it is **not recommended** to use a custom path for OliveTin. Instructions are provided below though, and it mostly-works.
  15. .nginx.conf
  16. [source,nginx]
  17. ----
  18. ....
  19. location /OliveTin/ {
  20. proxy_pass http://localhost:1337/;
  21. proxy_redirect http://localhost:1337/ http://localhost/OliveTin/;
  22. }
  23. location /OliveTin/websocket {
  24. proxy_set_header Upgrade "websocket";
  25. proxy_set_header Connection "upgrade";
  26. proxy_pass http://localhost:1337/websocket;
  27. proxy_read_timeout 600s;
  28. proxy_send_timeout 600s;
  29. }
  30. ....
  31. ----
  32. include::partial$reverse-proxies/external-rest.adoc[]