Nginx Config Generator
Generate Nginx server configuration files
nginx.section.basic
nginx.section.features
Nginx Configuration Guide
Configuration File Location
# Main config: /etc/nginx/nginx.conf
# Site configs: /etc/nginx/sites-available/
# Enabled sites: /etc/nginx/sites-enabled/
Common Commands
# Test configuration
sudo nginx -t
# Reload configuration
sudo systemctl reload nginx
# Restart Nginx
sudo systemctl restart nginx
# Enable site
sudo ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/
SSL with Let's Encrypt
# Install Certbot
sudo apt install certbot python3-certbot-nginx
# Obtain certificate
sudo certbot --nginx -d example.com -d www.example.com
# Auto-renewal
sudo certbot renew --dry-run
Best Practices
- Always test configuration before reloading:
nginx -t - Use HTTPS with HTTP/2 for better performance
- Enable gzip compression for text-based content
- Set appropriate cache headers for static files
- Configure security headers (X-Frame-Options, CSP, etc.)
- Use separate log files for each virtual host
Related Tools
Verwandte Tools
Alle Linux & System-Tools ansehenEntdecke Tools, die gut dazu passen.