i did setup my website on digital ocean i did use ubuntu 20.04
vm the website is basic mern application and i did use nginx 1.18.0
as a reverse proxy and the intital nginx configuration was like that
server {
listen 80
server_name kwarezma.one www.kwarezma.one;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
location /api {
# This is my nodejs API
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
the path to my conf is /etc/nginx/sites-available/default
after using certbot to install ssl my config changed to this
server {
server_name kwarezma.one www.kwarezma.one;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
location /api {
# This is my nodejs API
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/kwarezma.one/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/kwarezma.one/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.kwarezma.one) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = kwarezma.one) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name kwarezma.one www.kwarezma.one;
return 404; # managed by Certbot
}
but now when i visited my website kwarezma.one or www.kwarezma.com it docent work and i have no clue what happened so any help here will be much appreciated