Nginx: Difference between revisions

From Piszczynski
piszczynski>Aleks
(Created page with " == Add Websocket to Nginx Proxy == Add the following in config file: <pre> upstream websocket { server <ipaddress of server to proxy to>:<port number>; } # Websocke...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Nginx Config ==
Default config file location: /etc/nginx/nginx.conf


== Add Websocket to Nginx Proxy ==
== Add Websocket to Nginx Proxy ==

Latest revision as of 23:19, 16 November 2023

Nginx Config

Default config file location: /etc/nginx/nginx.conf

Add Websocket to Nginx Proxy

Add the following in config file:

upstream websocket {

  server <ipaddress of server to proxy to>:<port number>;

}



 # Websocket location block

  

  location /<location of service on webserver> {

    proxy_pass https://websocket;

    proxy_http_version 1.1;

    proxy_set_header Upgrade $http_upgrade;

    proxy_set_header Connection "upgrade";

    proxy_set_header Host $host;

    }