Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGINX with SSL #334

Closed
stefaang opened this issue Oct 11, 2016 · 2 comments
Closed

NGINX with SSL #334

stefaang opened this issue Oct 11, 2016 · 2 comments

Comments

@stefaang
Copy link

I'd like to share my NGINX config file as it is even simpler than in the documentation.. and it has basic SSL support. Just let me know if you rather want me to post this in the wiki.
The official documentation removes redirection for some unknown reason (I suspect copy pasta).
Anyway, this is a good starting point for wss:// support.

server {
   listen 80;
   server_name "insertsitename.com";
   return 301 https://$server_name$request_uri;
}

server {
   listen 443;
   server_name "insertsitename.com";

   add_header Strict-Transport-Security "max-age=31536000";

   ssl on;
   ssl_certificate     /etc/nginx/certificates/insertsitename.com.crt;
   ssl_certificate_key /etc/nginx/certificates/insertsitename.com.key;

   location / {
      include proxy_params;
      proxy_pass http://127.0.0.1:5000;
   }

   location /socket.io {
      proxy_pass http://127.0.0.1:5000/socket.io;
      proxy_http_version 1.1;
      proxy_buffering off;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
      proxy_read_timeout 86400;
   }
}
@miguelgrinberg
Copy link
Owner

Thanks!

I will combine some of your improvements/simplifications with the example that I have in the documentation.

@miguelgrinberg
Copy link
Owner

I did not include SSL in the examples, since that is unrelated to Socket.IO, but I did take some of the other improvements you are suggesting here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants