Nginx: Difference between revisions

From Piszczynski
m (1 revision imported)
No edit summary
 
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 00:19, 17 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;

    }