Navigation

Quick access to Hosting Cambodia pages

Server & DevOps

Nginx Server Block Compiler

Compile a production-ready Nginx server block for any domain or subdomain — static site, reverse proxy or PHP-FPM — with HTTPS redirect, Let’s Encrypt paths, HTTP/2, gzip, caching and security headers. Copy a correct config instead of hand-writing one at 2am.

Loading tool…

Need reliable hosting, a domain, or a hand setting this up?

Get a free quote →

About the Nginx Server Block Compiler

The Nginx Server Block Compiler turns a domain or subdomain into a complete, production-ready Nginx virtual host file in seconds. Choose whether the site serves static files, reverse-proxies to an application port (Node.js, Next.js, or any local service), or runs PHP through PHP-FPM, and the tool assembles the correct listen directives, HTTP to HTTPS redirect, www to apex canonical redirect, HTTP/2, gzip compression, security headers, Let's Encrypt certificate paths, client_max_body_size, and a long-lived static asset cache block. It even includes the exact certbot command to obtain the certificate before you reload Nginx.

This free tool by Hosting Cambodia is built for developers, sysadmins, and DevOps engineers in Phnom Penh, Siem Reap, and across Cambodia and the world who deploy sites to VPS or cloud servers. Instead of copying a half-remembered config from an old server and hunting typos, fill in a form, download the ready-made .conf file, run nginx -t, and reload. Every directive follows current Nginx best practice, including WebSocket-safe proxy headers and an ACME challenge location that keeps certificate renewals working after the HTTPS redirect is in place.

Frequently asked questions

Where do I put the generated server block file?

On Debian and Ubuntu servers, save it as /etc/nginx/sites-available/yourdomain.conf and symlink it into /etc/nginx/sites-enabled/. On CentOS-style layouts, place it in /etc/nginx/conf.d/ instead. Always run sudo nginx -t to validate the syntax before reloading Nginx.

Do I need the SSL certificate before or after uploading the config?

Before. The generated file references certificate paths under /etc/letsencrypt/live/, so run the included certbot command first to create them. If Nginx reloads while those files are missing it will fail with an error, which is why the tool prints the certbot hint as a comment at the top.

What is the difference between the three site types?

Static files serves HTML, CSS, JS, and images straight from a folder. Reverse proxy forwards all traffic to an application listening on a local port, such as a Node.js or Next.js server, with WebSocket support included. PHP-FPM routes .php requests to a PHP FastCGI socket, which is the standard setup for WordPress and Laravel.

Explore the full free web tools toolbox by Hosting Cambodia.