Choose configuration type: reverse proxy, SSL, or load balancer
Enter server details, ports, and backend addresses
Generate and download your nginx.conf file
nginx (pronounced "engine-x") is a high-performance web server, reverse proxy, and load balancer. Originally created to solve the C10K problem (handling 10,000 concurrent connections), nginx has become one of the most popular web servers in the world, powering over 30% of all websites.
Unlike traditional web servers that create a new process or thread for each connection, nginx uses an asynchronous, event-driven architecture that can handle thousands of concurrent connections with minimal memory footprint. This makes it ideal for high-traffic websites, microservices architectures, and API gateways.
Choose the type of nginx configuration you need. Reverse proxy is most common for forwarding requests to backend applications. SSL/TLS is for HTTPS setup. Load balancer distributes traffic across multiple servers.
Enter your domain name and the port nginx should listen on (typically 80 for HTTP or 443 for HTTPS). For the backend, specify where nginx should forward requests (e.g., localhost:3000 for a Node.js app).
Click "Generate Config" to create your configuration. Review the output, then download it. Place the file in /etc/nginx/sites-available/ on your server, create a symlink to sites-enabled, and reload nginx with `sudo nginx -s reload`.
Use nginx as a reverse proxy in front of your Node.js application. nginx handles SSL termination, static files, and forwards dynamic requests to your Node.js server running on a local port.
Configure nginx to route requests to different microservices based on URL paths. This provides a single entry point for your microservices architecture while distributing requests to appropriate backend services.
Distribute incoming traffic across multiple backend servers to handle high load. nginx can use round-robin, least connections, or IP hash algorithms to balance requests efficiently.
Serve static HTML, CSS, and JavaScript files directly from nginx with optimal caching headers. nginx's efficient static file serving can handle thousands of concurrent connections with minimal resources.
Proxy WebSocket connections from clients to backend WebSocket servers. nginx handles the HTTP upgrade handshake and maintains long-lived connections efficiently.
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen 443 ssl http2;
server_name example.com;
ssl_certificate /etc/ssl/certs/example.com.crt;
ssl_certificate_key /etc/ssl/private/example.com.key;
ssl_protocols TLSv1.2 TLSv1.3;
location / {
proxy_pass http://localhost:3000;
}
}
upstream backend {
server backend1.example.com;
server backend2.example.com;
server backend3.example.com;
}
server {
listen 80;
location / {
proxy_pass http://backend;
}
}
server {
listen 80;
server_name example.com;
root /var/www/html;
location ~* \.(jpg|jpeg|png|gif|css|js)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
location /ws {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Explore our other configuration generators:
Get $200 free DigitalOcean credit or sponsor us on GitHub!