Improve Certbot nginx config generate

Hi all.. First of all thanks for giving us that nice product!

Why use weird if's in nginx config, when you can not!? Event nginx creator Igor Sysoev have said in one of his video, if you you can not use if statements, dont use them..

So instead of

if ($host = www.jonsson.am) {
    return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = jonsson.am) {
    return 301 https://$host$request_uri;
} # managed by Certbot

listen 80 ;
listen [::]:80 ;
server_name jonsson.am www.jonsson.am;
return 404; # managed by Certbot

use

listen 80 ;
listen [::]:80 ;
server_name jonsson.am www.jonsson.am;
return 301 https://$host$request_uri; # managed by Certbot

and please, try to do something with those comments, because of them at the end of line, we can't properly indent entire file with vim command gg=G @ vim - How do I fix the indentation of an entire file in Vi? - Stack Overflow

github issue: Improve certbot config generator · Issue #9705 · certbot/certbot · GitHub

Thanks!

3 Likes

While some certbot maintainers might read this forum, you should probably file these at Github issues at GitHub - certbot/certbot: Certbot is EFF's tool to obtain certs from Let's Encrypt and (optionally) auto-enable HTTPS on your server. It can also act as a client for any other CA that uses the ACME protocol.

5 Likes

Ouuchh, sorry, i thought there was no Issue's tab.. My bad, I will post issue in github project, thanks!

4 Likes

Thanks for filing your issue at

Hopefully the current Certbot developers will comment on it. (I left a comment with my recollection about one reason that might have motivated the existing behavior.)

4 Likes

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