1
0
Fork 0
platypush/examples/nginx/nginx.sample.conf

55 lines
1.6 KiB
Text

# An nginx configuration that can be used to reverse proxy connections to your
# Platypush' HTTP service.
upstream platypush {
# The address and port where the HTTP backend is listening
server 127.0.0.1:8008;
}
server {
server_name platypush.example.com;
# Proxy standard HTTP connections
location / {
proxy_pass http://platypush;
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://platypush;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_http_version 1.1;
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/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;
# }