Accidentally removed Cert

ls -l /etc/nginx/conf.d/*.conf
ls: cannot access '/etc/nginx/conf.d/*.conf': No such file or directory

ls -l /etc/nginx/sites-enabled
total 4
-rw-r--r-- 1 root root 876 May 31 04:37 default
lrwxrwxrwx 1 root root 55 Sep 19 08:32 mwiki.taktylstudios.com.conf -> /etc/nginx/sites-available/mwiki.taktylstudios.com.conf
lrwxrwxrwx 1 root root 57 May 6 07:52 staging.taktylstudios.com.conf -> /etc/nginx/sites-available/staging.taktylstudios.com.conf

and contents of this:

/etc/nginx/sites-enabled/mwiki.taktylstudios.com.conf
2 Likes

server {
listen 80;
server_name mwiki.taktylstudios.com www.mwiki.taktylstudios.com;
return 301 https://$host$request_uri;
}

1 Like

and this

/etc/nginx/sites-enabled/default
2 Likes
server {

        server_name mwiki.taktylstudios.com;

        location / {
            proxy_pass http://127.0.0.1:5000;
            proxy_set_header Host $host;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mwiki.taktylstudios.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mwiki.taktylstudios.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 = mwiki.taktylstudios.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80 default_server;
        listen [::]:80 default_server;

        server_name mwiki.taktylstudios.com;
    return 404; # managed by Certbot


}

that's a funny place to hide the https server block :slight_smile:

Would you please add 3 backticks before and after that data. Will be much easier to read

2 Likes

my bad sir im kinda newbie in this work hahaha

1 Like

OK, I understand what you have now. In your first post you said you didn't need the mwiki cert anymore. Do you want to try to re-create it? Or, do you just want to delete it so nginx can start again?

2 Likes

yes sir that's why I removed it manually. I want to delete so that nginx can start again.

Once we get nginx started, do you want to make the mwiki cert again?

2 Likes

nope sir only the staging.taktylstudios.com is needed, I only created the mwiki.taktylstudios.com for testing purposes.

1 Like

OK, that makes it easy. Just delete these two files:

rm /etc/nginx/sites-enabled/default
rm /etc/nginx/sites-enabled/mwiki.taktylstudios.com.conf

Then, try this again

sudo nginx -t
3 Likes

sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

whoo i think nginx is running now thanks a lot for your help and time I really appreciate it!

1 Like

Sure. You are welcome. But, you need to start nginx to get it running. That just checked the syntax. But, it will start now.

2 Likes

yes sir i used the code: systemctl restart nginx

thanks to you again sir! you saved my job hahahaha

2 Likes

Since you no longer use mwiki domain name, you should remove the A record from the DNS too

3 Likes

oops you're right sir.. removing it now on our hosting account thanks!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.