Tuesday, January 30, 2024

configure nginx

I want to use Certbot with Let’s Encrypt, but I don’t want my webserver to hand over the certificate to everyone knocking at my front door at poort 443.
Here’s how: I presume you have nginx and certbot installed.

Generate a self-singed certificate:

mkdir /etc/nginx/ssl/
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt

Now use this certificate for the default listener. Also respond with a http 444 (empty reponse).

server {
    server_name _;
    listen 80 default_server;
    listen 443 ssl default_server;
    # sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;
    return 444; # no reponse
}

After that, all you have to do is create a file in /etc/nginx/sites-enabled/ e.g. blog.mydomain.com

server {
    listen 443 ssl;
    server_name blog.mydomain.com;
    root /var/www/blog.mydomain.com;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
}

Reload nginx.
Then run Certbot and follow the steps:

certbot --nginx --staple-ocsp -d blog.mydomain.com

Connecting with ssl without the proper host-header will now present the self-signed certificate and reponds with an empty reponse.

  1. BRAND NEW PORN SITE SEX

    Monday, May 18, 2026 at 02:18:30

    Где смотреть порно, исследуя надежные платформы в
    Интернете. Изучите защищенные источники
    контента для приватного просмотра.

  2. Daily Backlinks

    Saturday, June 13, 2026 at 00:19:48

    Hi, Neat post. There’s a problem with your web site in web
    explorer, would check this? IE nonetheless is the market chief and a large component of other people will pass over your magnificent writing
    due to this problem.

  3. laicising

    Monday, June 29, 2026 at 18:44:39

    Hi! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for some
    targeted keywords but I’m not seeing very good gains. If you know of any please share.
    Appreciate it!

  4. гей-секс с пиной

    Sunday, July 5, 2026 at 17:18:59

    Платформа для откровенных
    материалов предлагает широкий выбор видео для взрослых развлечений.

    Выбирайте гарантированные порноцентры
    для конфиденциального опыта.

  5. 女同性恋色情影片

    Wednesday, July 8, 2026 at 09:00:35

    成人主题 在专为成熟观众设计的平台上广泛可用。选择 可靠的成人网站 以确保安全。

Add comment

Fill out the form below to add your own comments