Unable to renew Lets Encrypt certificate

The site owner created a Let's Encrypt certification through GoDaddy (where he bought the domain), but it wasn't possible to use it via Digital Ocean, so I simply used the Digital Ocean generated Let's Encrypt code. That SHOULD be the one that expired on May 23/24

1 Like

No worries, there is always someone around to help.
[tag I'm it]

3 Likes

Please show:
certbot certificates
crontab -l

3 Likes

Honestly, I don't know if both server blocks are in the nginx.conf file. How can I check for you?

1 Like

root@wfx-prod:~# certbot certificates

Saving debug log to /var/log/letsencrypt/letsencrypt.log
OCSP check failed for /etc/letsencrypt/live/www.worldfixer.com/cert.pem (are we offline?)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: www.worldfixer.com
    Domains: www.worldfixer.com
    Expiry Date: 2022-05-23 13:25:35+00:00 (INVALID: EXPIRED)
    Certificate Path: /etc/letsencrypt/live/www.worldfixer.com/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/www.worldfixer.com/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 Like

root@wfx-prod:~# crontab -l

no crontab for root
1 Like

This will show it all:
nginx -T

3 Likes

This is what I get:

root@wfx-prod:~# nginx -T

nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/worldfixer.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/worldfixer.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
1 Like

hmm...
Try:
grep -Ri fullchain.pem /etc/nginx

3 Likes

root@wfx-prod:~# grep -Ri fullchain.pem /etc/nginx

/etc/nginx/sites-enabled/01-hp_wfx.save:    ssl_certificate /etc/letsencrypt/live/worldfixer.com/fullchain.pem; # managed by Certbot
/etc/nginx/sites-enabled/01-hp_wfx:    ssl_certificate /etc/letsencrypt/live/worldfixer.com/fullchain.pem; # managed by Certbot
1 Like

Show:
cat /etc/nginx/sites-enabled/01-hp_wfx

3 Likes

root@wfx-prod:~# cat /etc/nginx/sites-enabled/01-hp_wfx

server {
    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css image/svg+xml application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    server_name beta.worldfixer.com worldfixer.com www.worldfixer.com 134.122.77.70;
    charset     utf-8;
    sendfile_max_chunk 512k;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    location /media  {
        alias /home/deployer_backend/hackpack-wfx-server/media;  # your Django project's media files - amend as required
        expires 300d;
    }

    location /static {
        alias /home/deployer_backend/hackpack-wfx-server/static; # your Django project's static files - amend as required
        expires 7d;
    }

    location /0.ac9c7c83a0474d4912af.chunk.js {
        alias /home/deployer_backend/hackpack-wfx-server/static/users/wfx_chunk.js;
    }

    location /sw.js {
        alias /home/deployer_backend/hackpack-wfx-server/static/users/sw.js;
    }

    location /robots.txt {
        alias /home/deployer_backend/hackpack-wfx-server/static/users/robots.txt;
    }

    location ~ /(.git|.gitignore|.idea|README.md|components|documentation|modules|node_modules|package-lock.json|package.json|shared|webpack.config.js) {
        deny all;
        return 404;
    }

    location ~ ^/(social|admin|rpc|sms|user_files|n|logout|__debug__)/ {
        proxy_hide_header "X-Frame-Options";
        set $frame_options '';
        if ($http_referer !~ '^https?:\/\/([^\/]+\.)?(facestudio\.ru|webvisor\.com)\/'){
            set $frame_options 'SAMEORIGIN';
        }
        add_header X-Frame-Options $frame_options;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://127.0.0.1:8123;
    }

    location / {
        root /home/deployer_frontend/hackpack-wfx-frontend;
        try_files $uri $uri/ /index.html;
        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    }

    location /app/ {
        root /home/deployer_frontend/hackpack-wfx-frontend;
        try_files $uri $uri/ /app-index.html;
        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    }

    location /about-us {
        root /home/deployer_frontend/hackpack-wfx-frontend;
        try_files $uri $uri/ /world-fixer-about-us.html;
        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    }

    access_log  /var/log/nginx/hp_wfx_access.log;
    error_log  /var/log/nginx/hp_wfx_error.log;


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/worldfixer.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/worldfixer.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 = worldfixer.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    if ($host = www.worldfixer.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name beta.worldfixer.com worldfixer.com www.worldfixer.com;
    listen 80;
    return 404; # managed by Certbot
}
1 Like

Edit that file, and change these two lines:

To:

    ssl_certificate /etc/letsencrypt/live/www.worldfixer.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/www.worldfixer.com/privkey.pem; # managed by Certbot

[just insert "www." in both]
Then show:
nginx -T

3 Likes

Sorry, but how do I edit the lines in the terminal?

1 Like

Like this right:

  • If you want to edit a file using terminal, press i to go into insert mode.
  • Edit your file and press ESC and then :w to save changes and :q to quit.
1 Like

Those sound like vi commands.
I suppose so.

Do you have SSH/PuTTY access?

3 Likes

SSH. Just not seeing how I can edit an existing line in the code. There's Nano if I can figure out how to get back there, but not sure how to get that to do edits for me

1 Like

There are several different editors.
Whichever one you choose, you should find a tutorial online to understand it.

3 Likes

Briliant. One sec. I'll get a quick lesson and make those changes

1 Like

No I guess I mean, what's the process?

Do I need to pull the original command, then after that, open up some editor thing. Like vi. Then copy and paste the entirety of the text for the command that I had previously received + the change? Then save, then exit? That seems to be the correct process, right? Never done it before

1 Like