From 0de56ad52e0457501e0f477c51fae1eace2aa8b7 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 10 May 2023 00:59:41 +0200 Subject: [PATCH] Added nginx sample configuration. --- examples/nginx/nginx.sample.conf | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 examples/nginx/nginx.sample.conf diff --git a/examples/nginx/nginx.sample.conf b/examples/nginx/nginx.sample.conf new file mode 100644 index 00000000..321ae42d --- /dev/null +++ b/examples/nginx/nginx.sample.conf @@ -0,0 +1,38 @@ +# An nginx configuration that can be used to reverse proxy connections to your +# Platypush' HTTP service. + +server { + server_name my-platypush-host.domain.com; + + # Proxy standard HTTP connections to your Platypush IP + location / { + proxy_pass http://my-platypush-host:8008/; + + client_max_body_size 5M; + proxy_read_timeout 60; + proxy_connect_timeout 60; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Ssl on; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + # Proxy websocket connections + location ~ ^/ws/(.*)$ { + proxy_pass http://10.0.0.2:8008/ws/$1; + + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_redirect off; + proxy_http_version 1.1; + client_max_body_size 200M; + proxy_set_header Host $http_host; + } + + # Optional SSL configuration - using Let's Encrypt certificates in this case + # listen 443 ssl; + # ssl_certificate /etc/letsencrypt/live/my-platypush-host.domain.com/fullchain.pem; + # ssl_certificate_key /etc/letsencrypt/live/my-platypush-host.domain.com/privkey.pem; + # include /etc/letsencrypt/options-ssl-nginx.conf; + # ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; +}