Nginx Config Generator
Generate production-ready Nginx configs visually. Reverse proxy, static site, PHP, redirects.
Reverse Proxy
Proxy to Node, Python, etc.
Reverse Proxy Options
nginx.conf
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffers 16 16k;
proxy_buffer_size 32k;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
}Save to /etc/nginx/sites-available/yourdomain.conf then run sudo nginx -t
Frequently Asked Questions
- Where do I put the Nginx config file?
- Save it to /etc/nginx/sites-available/yourdomain.conf, then enable it with: sudo ln -s /etc/nginx/sites-available/yourdomain.conf /etc/nginx/sites-enabled/ && sudo nginx -t && sudo systemctl reload nginx
- How do I set up SSL with Let's Encrypt?
- Install Certbot: sudo apt install certbot python3-certbot-nginx, then run: sudo certbot --nginx -d yourdomain.com. Certbot will automatically update your Nginx config.
- What is a reverse proxy?
- A reverse proxy forwards client requests to a backend server (like Node.js, Python, or Docker) and returns the response. Nginx handles SSL, compression, and caching while your app stays simple.
- What does proxy_set_header X-Real-IP do?
- It passes the original client IP address to your backend application. Without it, your app would only see the Nginx server's IP instead of the real visitor's IP.
- How do I test my Nginx config before applying?
- Run: sudo nginx -t. This checks for syntax errors. Then reload with: sudo systemctl reload nginx (not restart — reload applies changes without downtime).