Nginx Config Generator
Generate a clean Nginx server block without memorizing the syntax. Pick static, reverse proxy or PHP, set your domain and root or upstream, toggle SSL and gzip, then copy the config into your sites-available folder.
How to generate an Nginx config
- Enter your domain and choose a mode: static, reverse proxy or PHP.
- Set the document root or upstream target, then toggle SSL, gzip and a max body size.
- Copy the output or download nginx.conf into your sites-available folder.
Examples
Reverse proxy to a Node app on port 3000
mode: reverse-proxy, proxyPass: http://localhost:3000, serverName: example.com
server {
listen 80;
listen [::]:80;
server_name example.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
...
}
}Static site with HTTPS
mode: static, root: /var/www/html, enableSsl: true, serverName: example.com
server {
listen 80;
server_name example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
ssl_certificate ...;
root /var/www/html;
location / {
try_files $uri $uri/ =404;
}
}Frequently asked questions
What is an Nginx server block?
A server block is the part of an Nginx config that defines how to handle requests for one site, including which port and domain to listen on, where files live and how to route or proxy requests. It is the Nginx equivalent of an Apache virtual host.
Where do I put the generated config?
Save it in /etc/nginx/sites-available/ (or /etc/nginx/conf.d/ on some distros) as your-site.conf, symlink it into sites-enabled, then run nginx -t to test and reload Nginx. On many setups the path is /etc/nginx/sites-enabled/your-site.
What is the difference between static, reverse proxy and PHP mode?
Static serves files straight from a document root with try_files. Reverse proxy forwards requests to an upstream app, such as a Node or Python server on localhost, and sets the usual forwarding headers. PHP serves files and passes .php requests to PHP-FPM over a FastCGI socket.
Does the SSL option set up real certificates?
No. It writes the listen 443 ssl lines, ssl_certificate paths and an http to https redirect, but you still need real certificate files. Tools like Certbot can issue free certificates and fill in the correct paths for you.
Will this config work on Apache?
No. The server block syntax is specific to Nginx. Apache uses a different format with VirtualHost and .htaccess. If you are on Apache, generate an .htaccess or virtual host instead.
Is my data sent to a server?
No. The config is generated entirely in your browser from the options you set, so nothing you type is uploaded anywhere.
Related tools
Htaccess Generator
Build an Apache .htaccess file with toggles for HTTPS, www, redirects, blocked IPs, error pages, caching and compression. Copy or download it.
Redirect Checker
Paste a redirect map and see every chain mapped out, with loops, multi-hop chains, duplicate sources and temporary 302s flagged. Runs in your browser.
Gitignore Generator
Build a .gitignore from Node, Python, Java, Go, Rust, macOS, Windows and more. Pick your stacks, copy or download the file. Runs in your browser.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.