0

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

scripter
  • 1,211
  • 2
  • 11
  • 21

1 Answers1

0

1- read my answer here : cannot install certbot on amazon linux2 nginx

2- be sure that you have a A record ( for your domain ) or a CNAME record ( for your subdomain ) well configured.

3- Next check your issue from this step by recreating a ssl certificate for your domain or subdomain :

 sudo certbot --nginx 

( some where in output, certbot will ask you the
domain name or the subdomain for which you want to install ssl )