The officially official Devuan Forum!

You are not logged in.

#701 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-04 03:08:08

Your last wget test some posts ago looked all fine. I wold not suggest that you start from the top.

#702 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-03 04:38:00

I meant the host that runs nginx; would be "the Dell-Devuan server" in your house smile

My port probing says that port 80 is open and port 443 is closed; other ports called filtered.

Since you also don't get service on port 443 it means that either nginx does not listen at all, or there is some firewall block in between.

Just for completeness, you should generate the dhparam.pem file:

# openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

and add an ssl_dhparam directive as new line 25 in realupnow.com.conf:

    ssh_dhparam /etc/ssl/certs/dhparam.pem ;

And restart nginx.

After that nginx you could try on that host
# wget -H -O/dev/null http://realupnow.com/
in order to verify that nginx services port 443 (ssl).

EDIT: added semi-colon to the config line.

#703 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-03 04:12:28

Yes all configuration looks fine, although some ssl settings can probably be tuned. But it should connect and allow access. One thing missing is the ssl_dhparam setting which according to doc is required when/if DH ciphers are used. But I would have thought nginx would issue an error message when started/restarted if that would stop it from opening the ssl listener. Try with stopping nginx, then starting it, and check the error log.

Does that host have any local firewall?

#704 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-03 03:21:36

Is there a recent /var/log/php7.4-fpm.log and how does that look, if so?

#706 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-03 02:40:23

The error.log I just posted is the most recent

Did you confirm that? I accessed your server more recent than that and before I made my post.

#707 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-03 02:24:38

Right. with wget -H http://www.realupnow.com I get that it connects on port 80, responds with redirect (301) to https, and then fails connection on port 443.

That is an indication that the ssl setup is wrong in some way. Perhaps you could show the log again, following your last entry.

#708 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-03 01:48:34

Suggestions:

1. remove the commented listen line (line 10).
2. Restore root /var/www/realupnow.com;
3. lift up the listen 443 ssl; to be new line 10, and
4. remove the # managed by Certbot junk from all lines.

Having default_server or not doesn't matter with a single configuration.

Next, forget about ssl-params.conf and instead use /etc/letsencrypt/options-ssl-nginx.conf, which is a gift from certbot (and there's no harm in publicizing ssl_ciphers).

The question is why there is a complaint about it in the log; try with commenting out that line, and restart nginx.

#709 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-03 00:09:09

Hmm nginx is running but not serving pages...

Where did those "managed by certbot" lines come from? That configuration file of post #89 is a bit different from the one you showed at post #57 and it confuses me... where did "default_server" comd from, and where did that ssl setup come from? And why is it "root /var/www" ? Is that really the right file? Did you (also:)) get tired yesterday?

The nginx log files are still in /var/log/nginx where it has error.log and access.log

#710 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 22:38:06

Firstly, it appears nginx is not running.

Does pgrep -a nginx say that it is?

Did you check the error log?

#711 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:48:38

mmm no the ssl-params.conf needs to be included outside of the location block... But it also seems you have at some time let certbot mess with the configuration and it has then given you a mix of stuff you may and may not want.

It's ok to use /etc/letsencrypt/options-ssl-nginx.conf instead of the currently non-existing /etc/nginx/snippets/ssl-params.conf although you of course will need to review that instead.

Just make sure to remove the "# managed by certbot" comment on that include line.

And in the future, do not ever, never, never run certbot with --nginx argument again as it will then want to mess with the configuration again. certbot might also have dropped a cron action (/etc/cron.d/certbot) to "do helpful things" that you may and might not want. That's another thing to review and clean up. (sometimes I wish that those "we must do it all" hats were much smaller)

Further certbot added stuff at the bottom of that service block, which amounts to enforcing a redirect response when the incoming request is not https. That's an ok function, but again I think you should remove the "# managed by certbot" comment.

So: what's in /etc/letsencrypt/options-ssl-nginx.conf ?

EDIT: I meant that file of course.

#712 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:18:29

Looks fine.

The final hurdle is to configure the ssl function of nginx and that's virtually a new ocean of possibilities. Though it typically reduces down into having two files: /etc/ssl/certs/dhparam.pem and  /etc/nginx/snippets/ssl-params.conf.
You might have those already.

Plus that the service configuration should includes the second, typically near the ssl_certificate directive.

include snippets/ssl-params.conf ;

#713 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:15:04

Ok; I had forgotten... you need to set up group access to live and archive:

# chmod g+rx /etc/letsencrypt/{live,archive}

#714 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:07:38

Hmm please show output of

# namei -om /etc/letsencrypt/live/realupnow.com/fullchain.pem

#715 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:01:49

If you are logged in as root then you won't need sudo.
Something else is wrong.
Can you copy&paste actually command and error?

#716 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:56:47

Right. The "#" prompt is normally the signal for commands that needs to be run as root.

#717 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:41:13

Ah, my mistake. The user is www-data... so perhaps the full sequence should be:

# addgroup ssl-cert
# chgrp ssl-cert /etc/letsencrypt/{live,archive}
# adduser www-data ssl-cert

And then you may verify access by getting no complaints from:

# runuser -u www-data cat /etc/letsencrypt/live/realupnow.com/fullchain.pem > /dev/null

#718 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:27:32

Next, the server block needs to include a couple of ssl directives, in particular ssl_certificate and ssl_certificate_key
with the full pathnames for the ssl certificate and key.

Your certificate and chain have been saved at:
/etc/letsencrypt/live/realupnow.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/realupnow.com/privkey.pem

Note now that nginx run as user www-data, and that it needs access to those files. If your setup includes group ssl-cert for /etc/letsencrypt/live and /etc/letsencrypt/archive then the easy step is to add nginx to that group:

# adduser nginx ssl-cert

and then you are almost there...

#719 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:23:36

Yes, if it comforts you. I wouldn't smile.
And yes, you need to change the nginx configuration accordingly.

(I would rather keep in mind that I've choosen my own root and adapt instructions where needed)

#720 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:06:09

Next, according to the manual the listen directive should look like:

listen 443 ssl;

and if you want it to include a "default_server" (which you don't smile) then that should be mentioned before the ssl tag rather than after it.

#721 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 02:58:09

Great. The ssl configuration can be merged with the plain http configration into a single "server {...}" block. That would bring the advantage of certainly sharing the "location {..}" blocks which are where you declare service the points.

But if you, as is customary nowawdays, primarily want to only provide https service, and hev the http service merely redirect to corresponding https service, then you would certainly have separate "server {..}" blocks.

#722 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 02:42:07

It doesn't matter too much; some editors provide indentation and "block" support for files ending in .conf which could be an argument for renaming, but the name is not important; only that the link has to point to the actual file.

The pathnames used in sites-enabled/ have the additional significance that nginx will process them in alphabetical order, and if many, the first ono is taken as "the default service" if it needs that. Since you have only one there is no potential of confusion.

In short: it's up to you smile but make sure the link is valid.

#723 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 02:06:44

You seem to still want the local names in the DNS setup to include the base domain name, and you have now defined resolution for www.realupnow.com.realupnow.com

The record should only have www and not www.realupnow.com

The local name will get realupnow.com appended automagically.

#724 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 01:30:05

To follow current sysadmin style, your nginx service configuration should be a main file /etc/nginx/sites-available/realupnow.conf and optionally a side file like /etc/nginx/snippets/ssl.conf, plus the link /etc/nginx/sites-enabled/realupnow.conf pointing to ../sites-available/realupnow.conf.

I don't see a direct need to change the main configuration in /etc/nginx/nginx.conf or /etc/nginx/nginx.conf.d/* but I might be wrong in that.

#725 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 01:22:10

No. apparently certbot includes some bogus advice that might be useful for some apache2 setups but certainly not relevant for you. It's just that the certbot developers have had their "we must do it all" hats on and try to make the tool do much more than just preparing the certificate.

With "certonly --webroot" option you avoid that but obviously the program will still insist with bogus (though technically harmless) instructions.

Board footer

Forum Software