diff --git a/examples/nginx/nginx.sample.conf b/examples/nginx/nginx.sample.conf new file mode 100644 index 000000000..321ae42d9 --- /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; +}