Skip to content

Instantly share code, notes, and snippets.

@Hidenmy
Last active March 24, 2021 10:06
Show Gist options
  • Save Hidenmy/232de69adeed2980570cda900ad1acec to your computer and use it in GitHub Desktop.
Save Hidenmy/232de69adeed2980570cda900ad1acec to your computer and use it in GitHub Desktop.
upstream socket {
ip_hash;
server 127.0.0.1:8000 fail_timeout=0;
}
server {
server_name freelancescanner.com;
access_log /var/log/nginx/freelancescanner.access.log;
error_log /var/log/nginx/freelancescanner.error.log;
location / {
proxy_pass http://socket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location /channel/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~ ^/google92e5184fd0d7bc0b.html$ {
alias /var/www/freelancescanner/config/analytics_google/google92e5184fd0d7bc0b.html;
}
location ~ ^/.well-known/apple-developer-merchantid-domain-association {
alias /var/www/freelancescanner/config/yookassa/merchant.ru.yoomoney;
}
location ~ ^/robots.txt$ {
alias /var/www/freelancescanner/templates/robots.txt;
}
location ~ ^/sitemap.xml$ {
alias /var/www/freelancescanner/templates/sitemap.xml;
}
location /static/ {
alias /var/www/freelancescanner/static_server/;
}
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
listen 8443 ssl;
ssl_certificate /etc/letsencrypt/live/freelancescanner.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/freelancescanner.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
if ($host = freelancescanner.com) {
return 301 https://$host$request_uri;
}
listen 80 ;
listen [::]:80 ;
server_name freelancescanner.com;
return 404;
}
wss://freelancescanner.com/channel/room/6/
<-- NGINX CONF FOR WSS -->
location /channel/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment