Consistent 404 errors when trying to move past the front end

SteveD

New Member
I am running (or attempting to run) mailwizz 2.7.3 on a Kamatera server (4 CPU's, 8 GB, 100GB storage, Ubuntu 24.04). I have reinstalled twice to ensure that I have placed the correct files and folders as required. I have been able to get through the install setup screens in both installs with no issues, including creating the cron jobs. I still get the 404 error (Unable to resolve the request "backend/index.php/guest/index") at the end of both installations. I have checked, verified an rechecked directory permissions per the documentation and community posts. I have adjusted the nginx code block, again, according the the documentation and community posts that have run into the same issue. At this time I cannot get past the 404 error to actually do anything within the application. Definitely could use a little assist...
 
Here is the current nginx.conf codeblock (one caveat, I have been using Gemini AI to assist with the troubleshooting, so things may be a little off, which shows some of my lack of backend coding experience)

server {
listen 80;
listen 443 ssl http2;
server_name dbsmail.deckplatesolutions.com;

# CRITICAL: Set the correct document root (YOUR path)
root /var/www/dbsmail.deckplatesolutions.com;
index index.html index.htm index.php;

# START OF CRITICAL MAILWIZZ REWRITE BLOCK (from community fix)
location / {
# This explicit rewrite logic is known to work for Mailwizz's routing
if (!-e $request_filename){
rewrite ^(/)?api/.*$ /api/index.php;
}
if (!-e $request_filename){
rewrite ^(/)?customer/.*$ /customer/index.php;
}
if (!-e $request_filename){
rewrite ^(/)?backend/.*$ /backend/index.php;
}
if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}
}
# END OF CRITICAL MAILWIZZ REWRITE BLOCK

# CRITICAL: PHP EXECUTION BLOCK (Robust with PHP 8.3 Socket)
location ~ [^/]\.php(/|$) {
# Check if the file exists before processing
try_files $uri =404;

# The correct socket path for PHP 8.3-FPM on Ubuntu 24.04
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;

include fastcgi_params;

# Passes the SCRIPT_FILENAME and PATH_INFO variables needed by the framework
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

# Increase timeouts
fastcgi_read_timeout 600s;
fastcgi_send_timeout 600s;
}

# Deny access to hidden files
location ~ /\.ht {
deny all;
}
}
 
In the location block where you do the rewrites, you're missing the index at the end:
NGINX:
location / {
         if (!-e $request_filename){
             rewrite ^(/)?api/.*$ /api/index.php;
         }
         if (!-e $request_filename){
             rewrite ^(/)?customer/.*$ /customer/index.php;
         }
         if (!-e $request_filename){
             rewrite ^(/)?backend/.*$ /backend/index.php;
         }
         if (!-e $request_filename){
             rewrite ^(.*)$ /index.php;
         }
         index  index.html index.htm index.php;
     }
please compare your block with the one in docs.

Alternatively, please try this and see if it makes any difference:

NGINX:
server {
    listen 80;
    listen 443 ssl http2;
    server_name dbsmail.deckplatesolutions.com;

    # CRITICAL: Set the correct document root (MailWizz install path)
    root /var/www/dbsmail.deckplatesolutions.com;
    index index.php index.html index.htm;

    # SSL (adjust/remove if handled by Plesk/Certbot/etc.)
    # ssl_certificate     /etc/letsencrypt/live/dbsmail.deckplatesolutions.com/fullchain.pem;
    # ssl_certificate_key /etc/letsencrypt/live/dbsmail.deckplatesolutions.com/privkey.pem;
    # include /etc/letsencrypt/options-ssl-nginx.conf;
    # ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    # ============================================================
    # CRITICAL: MAILWIZZ ROUTING / REWRITE BLOCK
    # ============================================================
    # Frontend (root)
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    # Customer area
    location /customer {
        index index.php;
        try_files $uri $uri/ /customer/index.php?$args;
    }

    # Backend area
    location /backend {
        index index.php;
        try_files $uri $uri/ /backend/index.php?$args;
    }

    # API
    location /api {
        index index.php;
        try_files $uri $uri/ /api/index.php?$args;
    }

    # ============================================================
    # PHP EXECUTION BLOCK (PHP-FPM 8.3 via socket)
    # ============================================================
    location ~ \.php$ {
        # Only serve existing PHP files
        try_files $uri =404;

        # PHP-FPM socket (adjust version/path if needed)
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;

        # Split PATH_INFO (not strictly required, but safe for frameworks)
        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_index index.php;

        # Timeouts (MailWizz can run heavy jobs)
        fastcgi_read_timeout 600s;
        fastcgi_send_timeout 600s;
    }

    # Deny access to hidden files (.htaccess, etc.)
    location ~ /\.ht {
        deny all;
    }
}
 
I tried both and still sitting at:

Error 404!​

Unable to resolve the request "backend/index.php/guest/index"

A bit frustrating. It's a little more involved to debug than I am used to these days.

Throwing the issue back and forth with Gemini and this is the question that it posed:

Is there a known Ubuntu 24.04/PHP 8.3 environment variable issue (e.g., specific AppArmor or Nginx/FPM package conflict) that prevents $fastcgi_path_info from being correctly consumed by the Yii framework, even after the standard fixes?
 
Back
Top