Skip to content

Instantly share code, notes, and snippets.

@bentech4u
Created March 23, 2020 13:30
Show Gist options
  • Save bentech4u/c0cdff947a02cf849379f47104410d7d to your computer and use it in GitHub Desktop.
Save bentech4u/c0cdff947a02cf849379f47104410d7d to your computer and use it in GitHub Desktop.
nginx-default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
proxy_pass http://127.0.0.1:8081;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_redirect http:// https://;
}
location /ws {
proxy_pass http://127.0.0.1:8081;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_redirect http:// https://;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name diykuwait.com www.diykuwait.com; # managed by Certbot
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_pass http://127.0.0.1:8081;
proxy_request_buffering off;
proxy_http_version 1.1;
}
location /ws {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_pass http://127.0.0.1:8081;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/diykuwait.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/diykuwait.com/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 = www.diykuwait.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = diykuwait.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name diykuwait.com www.diykuwait.com;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment