How to fix Blesta nginX Template

Hello, i’ve using nginX on my Server,
after create nginx Template for Blesta, its working Fine, But Blesta API & Feed not Working when using my nginX Template.

blesta.tpl -

server {
    listen      %ip%:%web_port%;
    server_name %domain_idn% %alias_idn%;
    # Root location block (Update %docroot%/blesta to your own Directory / @blesta is Default)
    root        %docroot%/blesta;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

    # Security: Prevent access to hidden files
    location ~ /\.(?!well-known\/) {
        deny all;
        return 404;
    }

    # Main location block (Update @blesta to your own Directory / @blesta is Default)
    location / {
        try_files $uri @blesta;
        rewrite ^(.*)/install\.php$ /$1/install/ redirect;
    }

    # PHP-FPM configuration for index.php
    location = /index.php {
        try_files $uri =404;

        include /etc/nginx/fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass %backend_lsnr%;
        include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
    }

    # Security: Block access to certain file types
    location ~ /\. {
        log_not_found off;
        return 404;
    }

    location ~* \.(php|pdt|txt)$ {
        log_not_found off;
        return 404;
    }

    # Error handling
    location /error/ {
        alias %home%/%user%/web/%domain%/application/app/views/errors/;
    }

    # Stats
    location /vstats/ {
        alias %home%/%user%/web/%domain%/stats/;
        include %home%/%user%/web/%domain%/stats/auth.conf*;
    }

    # Include additional configurations
    include /etc/nginx/conf.d/phpmyadmin.inc*;
    include /etc/nginx/conf.d/phppgadmin.inc*;
    include %home%/%user%/conf/web/%domain%/nginx.conf_*;

    # Core rewrite (Update @blesta to your own Directory / @blesta is Default)
    location @blesta {
        rewrite ^(.*)$ /index.php?$1 last;
    }
}

blesta.stpl -

server {
    listen      %ip%:%web_ssl_port% ssl;
    server_name %domain_idn% %alias_idn%;
    # Root location block (Update %docroot%/blesta to your own Directory / @blesta is Default)
    root        %sdocroot%/blesta;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    ssl_certificate     %ssl_pem%;
    ssl_certificate_key %ssl_key%;
    ssl_stapling        on;
    ssl_stapling_verify on;

    # TLS 1.3 0-RTT anti-replay
    if ($anti_replay = 307) { return 307 https://$host$request_uri; }
    if ($anti_replay = 425) { return 425; }

    # Security: HSTS
    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

    # Security: Prevent access to hidden files
    location ~ /\.(?!well-known\/) {
        deny all;
        return 404;
    }

     # Main location block (Update @blesta to your own Directory / @blesta is Default)
    location / {
        try_files $uri @blesta;
        rewrite ^(.*)/install\.php$ /$1/install/ redirect;
    }

    # PHP-FPM configuration for index.php
    location = /index.php {
        try_files $uri =404;

        include /etc/nginx/fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
        fastcgi_pass %backend_lsnr%;
        include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
    }

    # Security: Block access to certain file types
    location ~ /\. {
        log_not_found off;
        return 404;
    }

    location ~* \.(php|pdt|txt)$ {
        log_not_found off;
        return 404;
    }

    # Error handling
    location /error/ {
        alias %home%/%user%/web/%domain%/application/app/views/errors/;
    }

    # Stats
    location /vstats/ {
        alias %home%/%user%/web/%domain%/stats/;
        include %home%/%user%/web/%domain%/stats/auth.conf*;
    }

    # Include additional configurations
    include /etc/nginx/conf.d/phpmyadmin.inc*;
    include /etc/nginx/conf.d/phppgadmin.inc*;
    include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;

    # Core rewrite (Update @blesta to your own Directory / @blesta is Default)
    location @blesta {
        rewrite ^(.*)$ /index.php?$1 last;
    }
}

Please help me how to fix Blesta API & Feed on HestiaCP.
Thanks in Advance.

Blesta.tpl

#=========================================================================#
# Default Web Domain Template                                             #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
# https://hestiacp.com/docs/server-administration/web-templates.html      #
#=========================================================================#

server {
        listen  %ip%:%web_port%; # IPv4
        listen [::]:%web_port%; # IPv6
        server_name %domain_idn% %alias_idn%; # Hostname
        
        include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
        include %home%/%user%/conf/web/%domain%/nginx.conf_*;
        # iFrame protection
        add_header X-Frame-Options SAMEORIGIN;
        location / {
                try_files $uri /index.php;
                rewrite ^(.*)/install.php$ /$1/install/redirect;
        }
        location = /index.php {
                fastcgi_pass	%backend_lsnr%; # PHP socket
                fastcgi_param	SCRIPT_FILENAME $document_root/index.php; # Blesta /index.php
                fastcgi_param	SCRIPT_NAME $fastcgi_script_name;
                include         /etc/nginx/fastcgi_params;
        }
        location ~ /\. {
                log_not_found off;
                return 404;
        }
        location ~* \.(php|pdt|txt)$ {
                log_not_found off;
                return 404;
        }
		
}

Blesta.stpl

#=========================================================================#
# Default Web Domain Template                                             #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
# https://hestiacp.com/docs/server-administration/web-templates.html      #
#=========================================================================#

server {
        listen  %ip%:%web_ssl_port% ssl; # IPv4
        listen [::]:%web_ssl_port% ssl; # IPv6
        server_name %domain_idn% %alias_idn%; # Hostname
        root %sdocroot%; # Installation directory
        # SSL cert/key pair
        ssl_certificate     %ssl_pem%;
        ssl_certificate_key %ssl_key%;
        ssl_stapling        on;
        ssl_stapling_verify on;

        # TLS 1.3 0-RTT anti-replay
        if ($anti_replay = 307) { return 307 https://$host$request_uri; }
        if ($anti_replay = 425) { return 425; }

        include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
        include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;

        # iFrame protection
        add_header X-Frame-Options SAMEORIGIN;
        location / {
                try_files $uri /index.php;
                rewrite ^(.*)/install.php$ /$1/install/redirect;
        }
        location = /index.php {
                fastcgi_pass	%backend_lsnr%; # PHP socket
                fastcgi_param	SCRIPT_FILENAME $document_root/index.php; # Blesta /index.php
                fastcgi_param	SCRIPT_NAME $fastcgi_script_name;
                include         /etc/nginx/fastcgi_params;
        }
        location ~ /\. {
                log_not_found off;
                return 404;
        }
        location ~* \.(php|pdt|txt)$ {
                log_not_found off;
                return 404;
        }
		
}

This is my template i didnt check exactly yours but i didnt have any problems with Blesta try with this and if your problem continues will see if its something from blesta’s side.

https://domain.com/index.php/feed/domain/pricing/?currency=USD&style=bootstrap&term=1,2,3,4,5,10 redirects to the home page and

https://domain.com/feed/domain/pricing/?currency=USD&style=bootstrap&term=1,2,3,4,5,10 never loads

I just added Few Changes now everything working fine…
Thanks

If you share what you have modified, others with the same issue could resolve the issue too.

I’ve Added Blesta nginX Template on GitHub (Updated old Code) - HestiaCP/templates/nginx/php-fpm at main · KholifaNetwork/HestiaCP · GitHub