Pular para o conteúdo principal
Config

nginx Config Generator

Generate an nginx server block with HTTPS, Let's Encrypt and proxy support.

# Generated by HostingSwift — review with `nginx -t` before reloading
server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    # Let's Encrypt HTTP-01 challenge
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name www.example.com;

    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers off;

    root /var/www/example.com;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}

Generated locally in your browser. Free.

About this tool

Free nginx config generator. Produce a server block with HTTPS, Let's Encrypt certificate paths, www/non-www canonicalisation and an optional reverse proxy to your app.

Frequently asked questions

Is the output safe to use?

It is a conservative, common starting point, but always review it and test with nginx -t before reloading.

How does the Let's Encrypt part work?

It sets the standard /etc/letsencrypt/live paths; issue the certificate first with certbot, then reload nginx.

What does the reverse proxy do?

When enabled, it forwards requests to your application's address and port, passing the correct Host and client headers.

Need more than a tool?

HostingSwift runs the servers too — VPS, web hosting, email, DNS and streaming, with a free tier to start.