Nginx Config Generator - Create Nginx Configuration

Generate Nginx configuration files visually. Support static site, reverse proxy, PHP-FPM, Node.js, SSL/HTTPS, gzip, and security headers.

Share

Server Type

Server Name

Enable SSL/HTTPS

Options

Generated Configuration

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 256;
gzip_types
    text/plain
    text/css
    application/json
    application/javascript
    text/xml
    application/xml
    application/xml+rss
    text/javascript;

server {
    listen 80;
    listen [::]:80;
    server_name example.com;
    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;

    root /var/www/html;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }

    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;

    location ~ /\.ht {
        deny all;
    }
}

Instructions

  • Select server type and configure settings
  • Toggle SSL, Gzip, Cache, and Security headers
  • Click Generate to create the config
  • Copy or download the configuration file

Related Tools

More Code & Dev Tools