LetsEncrypt Cannot Obtain Certificate

ls -l /etc/nginx/conf.d/
total 0

certbot --nginx
The requested nginx plugin does not appear to be installed

Please show:
ls -l /etc/nginx/sites-enabled/

ls: cannot access '/etc/nginx/sites-enabled/': No such file or directory

Your installation of nginx is being difficult…

grep -Ei 'include' /etc/nginx/*

sudo netstat -pant

grep -Ei ‘include’ /etc/nginx/*

/etc/nginx/nginx.conf:# Includes files with directives to load dynamic modules.
/etc/nginx/nginx.conf:include /etc/nginx/modules/.conf;
/etc/nginx/nginx.conf: # Includes mapping of file name extensions to MIME types of responses
/etc/nginx/nginx.conf: include /etc/nginx/mime.types;
/etc/nginx/nginx.conf: # Includes virtual hosts configs.
/etc/nginx/nginx.conf: include /etc/nginx/conf.d/
.conf;

sudo netstat -pant

sh: sudo: not found

netstat -pant

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

Are there things missing from the post?
Like the * before .conf
No lines for 'netstat -pant` ?

If the post eats or garbles your input, try adding three backticks before and after the entire post:

Like:

```
your entire post

```

Oh I see what you mean.

$ grep -Ei 'include' /etc/nginx/*

/etc/nginx/nginx.conf:# Includes files with directives to load dynamic modules.
/etc/nginx/nginx.conf:include /etc/nginx/modules/*.conf;
/etc/nginx/nginx.conf:  # Includes mapping of file name extensions to MIME types of responses
/etc/nginx/nginx.conf:  include /etc/nginx/mime.types;
/etc/nginx/nginx.conf:  # Includes virtual hosts configs.
/etc/nginx/nginx.conf:  include /etc/nginx/conf.d/*.conf;

and then

$ netstat -pant

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

So you have nginx
But it is not actually running :frowning:

[the netstat -pants are empty - LOL]

We may need to backup a step and get a higher view of this setup.
To understand what is where and how it all fits together.

Can you detail such a view?
[pen on napkin works for me]

I watched a youtube viedo of SpaceInvader, and following his steps got me to the part of installing LetsEncrypt, but when he did his port forwarding it worked, but mine didn’t. So I’m stuck here.

Edit:
Okay, here’s something wierd. When I went to my letsencrypt settings, it changed the settings.

So I removed and reinstalled it. 1. the docker name changed automatically to my name (odd) but when I ran those commands again I got this:

$ grep -Ei 'include' /etc/nginx/*
/etc/nginx/nginx.conf:# Includes files with directives to load dynamic modules.
/etc/nginx/nginx.conf:include /etc/nginx/modules/*.conf;
/etc/nginx/nginx.conf:  # Includes mapping of file name extensions to MIME types of responses
/etc/nginx/nginx.conf:  include /etc/nginx/mime.types;
/etc/nginx/nginx.conf:  # Includes virtual hosts configs.
/etc/nginx/nginx.conf:  include /etc/nginx/conf.d/*.conf;
$ netstat -pant

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.11:39355        0.0.0.0:*               LISTEN      -

Is /etc/nginx/ my webroot? (That doesn’t sound right)

Definitely NOT.
It should never be.

netstat continues to show nothing bound to port 80.
This means nginx is NOT running.
[maybe not set up to run automatically or is unable to run due to a configuration problem]

To see if nginx can run, try:
nginx -t

The include grep shows which files are being included into the nginx configuration:

include /etc/nginx/modules/*.conf;
[this includes all files ending in .conf in the modules folder]

include /etc/nginx/conf.d/*.conf;
[this includes all files ending in .conf in the conf.d folder]

‘’’
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() “/run/nginx/nginx.pid” failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
‘’’

This seems bad...

Please show:
ls -l /run/nginx/
grep -Eri 'pid' /etc/nginx

grep -Eri 'pid' /etc/nginx
ls: cannot access '/run/nginx/': No such file or directory

grep -Eri ‘pid’ /etc/nginx
Shows nothing; the prompt just pops up another three times.
Can’t I just go to CommunityApplications and install a program like nginx?

nginx is installed.
The default pid location appears to be missing (/run/nginx/) and that is preventing it from starting.
You can (1)create that location or (2)assign the pid file specifically to another location.
[to get nginx to run]

  1. mkdir /run
    mkdir /run/nginx

  2. edit file /etc/nginx/nginx.conf
    near the top add:
    pid /etc/nginx;
    [or use any other existing folder that nginx can access]

then try starting nginx with:
/etc/init.d/nginx start

What would cause that issue? Why would uninstalling and reinstalling LetsEncrypt not do this?

Seems my eginx.conf is in /mnt/user/appdata/nginx/nginx

$ mkdir /run
mkdir: cannot create directory ‘/run’: File exists
$ mkdir /run/nginx
$

I think I need to download a plugin to be able to edit config files on my server

That prompt means you are not logged in as root user.

I’ve been going through the console by clicking on LetsEncrypt and then console. Should I be doing all this through root@tower:~#?

If that is the same system, then sure.
Otherwise try your commands with sudo (or whichever way that system does Super User / Root User commands)
Like:
$ sudo /etc/init.d/nginx start

Is there any way I can reinstall nginx?