Created
July 2, 2018 10:25
-
-
Save jehy/738ad140d86463f71e61b236b7953190 to your computer and use it in GitHub Desktop.
websocket with nginx and ssl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream websocket { | |
server 127.0.0.1:8080; | |
} | |
server { | |
index index.html index.htm index.nginx-debian.html; | |
server_name shodan.onutotrip.ru; | |
location / { | |
proxy_pass http://websocket; | |
proxy_http_version 1.1; | |
proxy_set_header Host $host:$server_port; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
#proxy_set_header Connection $connection_upgrade; | |
} | |
listen [::]:443 ssl ipv6only=on; # managed by Certbot | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/shodan.onutotrip.ru/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/shodan.onutotrip.ru/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
} | |
server { | |
if ($host = shodan.onutotrip.ru) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name shodan.onutotrip.ru; | |
return 404; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment