diff --git a/examples/nginx/nginx.sample.conf b/examples/nginx/nginx.sample.conf index 321ae42d..b7cc465a 100644 --- a/examples/nginx/nginx.sample.conf +++ b/examples/nginx/nginx.sample.conf @@ -1,12 +1,17 @@ # An nginx configuration that can be used to reverse proxy connections to your # Platypush' HTTP service. -server { - server_name my-platypush-host.domain.com; +upstream platypush { + # The address and port where the HTTP backend is listening + server 127.0.0.1:8008; +} - # Proxy standard HTTP connections to your Platypush IP +server { + server_name platypush.example.com; + + # Proxy standard HTTP connections location / { - proxy_pass http://my-platypush-host:8008/; + proxy_pass http://platypush; client_max_body_size 5M; proxy_read_timeout 60; @@ -18,21 +23,33 @@ server { } # Proxy websocket connections - location ~ ^/ws/(.*)$ { - proxy_pass http://10.0.0.2:8008/ws/$1; + location /ws/ { + proxy_pass http://platypush; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; proxy_http_version 1.1; - client_max_body_size 200M; + client_max_body_size 5M; 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; + # ssl_certificate /etc/letsencrypt/live/platypush.example.com/fullchain.pem; + # ssl_certificate_key /etc/letsencrypt/live/platypush.example.com/privkey.pem; # include /etc/letsencrypt/options-ssl-nginx.conf; # ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; } + +# Uncomment if you are using SSL and you want to force an HTTPS upgrade to +# clients connecting over the port 80 +# server { +# if ($host = platypush.example.com) { +# return 301 https://$host$request_uri; +# } +# +# server_name platypush.example.com; +# listen 80; +# return 404; +# }