server {
    listen 20211;
    server_name _; #change this to your custom domain if you have one

    # Web-interface files location
    root /var/www/html/netalertx;
    
    # Main page
    index index.php;
    
    #rewrite /app/(.*) / permanent;
    add_header X-Forwarded-Prefix "/netalertx" always;
    proxy_set_header X-Forwarded-Prefix "/netalertx";

    # Specify a character set
    charset utf-8;

    location / {
        # Try to serve files directly, fallback to index.php
        try_files $uri $uri/ /index.php?$query_string;
    }

    # FastCGI configuration for PHP
    location ~ \.php$ {
        # Use a Unix socket for better performance
        fastcgi_pass unix:/var/run/php/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        include fastcgi_params;
    }
}
