Fresh Install backend 404 Page Not Found

Farid Khan

New Member
I am using CENTOS 7 64-bit, installed VestaCP v0.9.8-17. I created a nginx+PHP-FPM web site in VestaCP for mailwizz. I Installed mailwizz-1.3.8.6 on the vestacp website. Install goes fine, I am able to install mailwizz on the server without any issues. After install I delete the install folder in the website and then try to goto /backend and then nothing loads I get 404 error. Not sure whats causing this and cant seem to find any good documentation on how to fix it.

Any help would be appreciated. Thank you,
 
I did, but I was not sure where to put that content in the conf in the nginx conf that I have on my vestacp. Maybe there are a few lines that only need to be changed on the vestacp nginx.conf file? not replace that whole file? the vestacp nginx.conf has alot of data in it.
 
@Farid Khan - Never worked with vestacp, but i think it should give you some options to add additional nginx directives for your host?
if not, maybe try and paste the nginx.conf here and we can have a look.
 
@Farid Khan - the docker image is pretty solid, it should work without issues.
Learning docker, in case you never used it before, can help a lot in future for other types of work too.
 
I got the same problem here. I have a mailwizz fresh install in a linode VPS running Ngnix web server. I have other websites running without problems, but mailwizz returns the erro bellow after fresh install:

Error 404!

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

I tried to change my nginx.conf as showed here https://kb.mailwizz.com/articles/nginx-server-basic-configuration-for-mailwizz/ but when I did it, my nginx server fail to restart ou reload.

Bellow a copy of my nginx.conf file. Someone can help me to solve that problem please?

Code:
user www-data;
worker_processes auto;
worker_rlimit_nofile 100000;
pid /run/nginx.pid;

events {
    worker_connections 4096;
    multi_accept on;
}

http {
    ##
    # EasyEngine Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 30;
    types_hash_max_size 2048;

    server_tokens off;
    reset_timedout_connection on;
    add_header X-Powered-By "EasyEngine 3.7.4";
    add_header rt-Fastcgi-Cache $upstream_cache_status;

    # Limit Request
    limit_req_status 403;
    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

    # Proxy Settings
    # set_real_ip_from    proxy-server-ip;
    # real_ip_header    X-Forwarded-For;

    fastcgi_read_timeout 300;
    client_max_body_size 100m;

    ##
    # SSL Settings
    ##

    ssl_session_cache shared:SSL:20m;
    ssl_session_timeout 10m;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
    ##
    # Basic Settings
    ##
    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # Log format Settings
    log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] '
    '$http_host "$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent"';

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types
        application/atom+xml
        application/javascript
        application/json
        application/rss+xml
        application/vnd.ms-fontobject
        application/x-font-ttf
        application/x-web-app-manifest+json
        application/xhtml+xml
        application/xml
        font/opentype
        image/svg+xml
        image/x-icon
        text/css
        text/plain
        text/x-component
        text/xml
        text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#    # See sample authentication script at:
#    # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#    # auth_http localhost/auth.php;
#    # pop3_capabilities "TOP" "USER";
#    # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#    server {
#        listen     localhost:110;
#        protocol   pop3;
#        proxy      on;
#    }
#
#    server {
#        listen     localhost:143;
#        protocol   imap;
#        proxy      on;
#    }
#}
 
I got the same problem here. I have a mailwizz fresh install in a linode VPS running Ngnix web server. I have other websites running without problems, but mailwizz returns the erro bellow after fresh install:

Error 404!

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

I tried to change my nginx.conf as showed here https://kb.mailwizz.com/articles/nginx-server-basic-configuration-for-mailwizz/ but when I did it, my nginx server fail to restart ou reload.

Bellow a copy of my nginx.conf file. Someone can help me to solve that problem please?

Code:
user www-data;
worker_processes auto;
worker_rlimit_nofile 100000;
pid /run/nginx.pid;

events {
    worker_connections 4096;
    multi_accept on;
}

http {
    ##
    # EasyEngine Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 30;
    types_hash_max_size 2048;

    server_tokens off;
    reset_timedout_connection on;
    add_header X-Powered-By "EasyEngine 3.7.4";
    add_header rt-Fastcgi-Cache $upstream_cache_status;

    # Limit Request
    limit_req_status 403;
    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

    # Proxy Settings
    # set_real_ip_from    proxy-server-ip;
    # real_ip_header    X-Forwarded-For;

    fastcgi_read_timeout 300;
    client_max_body_size 100m;

    ##
    # SSL Settings
    ##

    ssl_session_cache shared:SSL:20m;
    ssl_session_timeout 10m;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
   
    ##
    # Basic Settings
    ##
    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # Log format Settings
    log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] '
    '$http_host "$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent"';

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types
        application/atom+xml
        application/javascript
        application/json
        application/rss+xml
        application/vnd.ms-fontobject
        application/x-font-ttf
        application/x-web-app-manifest+json
        application/xhtml+xml
        application/xml
        font/opentype
        image/svg+xml
        image/x-icon
        text/css
        text/plain
        text/x-component
        text/xml
        text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#    # See sample authentication script at:
#    # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#    # auth_http localhost/auth.php;
#    # pop3_capabilities "TOP" "USER";
#    # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#    server {
#        listen     localhost:110;
#        protocol   pop3;
#        proxy      on;
#    }
#
#    server {
#        listen     localhost:143;
#        protocol   imap;
#        proxy      on;
#    }
#}
# run the mwz requirements checker
# check the php handler
;)
 
Should I change something on my virtual host webroot file?
Code:
server {

    server_name ooriginal.com.br   www.ooriginal.com.br;

    root /var/www/ooriginal.com.br/htdocs;
    index  index.html index.htm index.php


    access_log /var/log/nginx/ooriginal.com.br.access.log rt_cache;
    error_log /var/log/nginx/ooriginal.com.br.error.log;


    include common/php.conf;     

    
    include common/locations.conf;
    include /var/www/ooriginal.com.br/conf/nginx/*.conf;


}
 
@Luis - in your nginx.conf you have this line
include /etc/nginx/sites-enabled/*;
which means additional files are loaded from that path, as you cleverly pointed out above, so the mailwizz specific code should go there, above the include common/php.conf; statement.
 
@Luis - in your nginx.conf you have this line
include /etc/nginx/sites-enabled/*;
which means additional files are loaded from that path, as you cleverly pointed out above, so the mailwizz specific code should go there, above the include common/php.conf; statement.

Hi!
I did the modifications on the webroot file as bellow. But nginx still fail to reload. Nginx -t command returns:
nginx: [emerg] unexpected "}" in /etc/nginx/sites-enabled/ooriginal.com.br:28
nginx: configuration file /etc/nginx/nginx.conf test failed
But I didn't saw nothing wrong on line 28.

Code:
server {

    server_name ooriginal.com.br   www.ooriginal.com.br;

    root /var/www/ooriginal.com.br/htdocs;

    access_log /var/log/nginx/ooriginal.com.br.access.log rt_cache;
    error_log /var/log/nginx/ooriginal.com.br.error.log;


    include common/php.conf;     

     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
     }
 
     #error_page  404              /404.html;
 
     # redirect server error pages to the static page /50x.html
     #
     error_page   500 502 503 504  /50x.html;
 
     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
     #
     location ~ \.php$ {
         fastcgi_split_path_info  ^(.+\.php)(.*)$;
 
         fastcgi_param  PATH_INFO        $fastcgi_path_info;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include fastcgi_params;
 
         fastcgi_pass   127.0.0.1:9000;
         fastcgi_index  index.php;
 
         fastcgi_read_timeout 600s;
         fastcgi_send_timeout 600s;
     }
 
     # deny access to .htaccess files, if Apache's document root
     # concurs with nginx's one
     #
     location ~ /\.ht {
         deny  all;
     }   


    include common/locations.conf;
    include /var/www/ooriginal.com.br/conf/nginx/*.conf;


}
 
If you take out the "
Code:
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
    }
block, does it show same error ?
 
Hi!
I did the modifications on the webroot file as bellow. But nginx still fail to reload. Nginx -t command returns:

But I didn't saw nothing wrong on line 28.

Code:
server {

    server_name ooriginal.com.br   www.ooriginal.com.br;

    root /var/www/ooriginal.com.br/htdocs;

    access_log /var/log/nginx/ooriginal.com.br.access.log rt_cache;
    error_log /var/log/nginx/ooriginal.com.br.error.log;


    include common/php.conf;   

     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
     }
 
     #error_page  404              /404.html;
 
     # redirect server error pages to the static page /50x.html
     #
     error_page   500 502 503 504  /50x.html;
 
     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
     #
     location ~ \.php$ {
         fastcgi_split_path_info  ^(.+\.php)(.*)$;
 
         fastcgi_param  PATH_INFO        $fastcgi_path_info;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include fastcgi_params;
 
         fastcgi_pass   127.0.0.1:9000;
         fastcgi_index  index.php;
 
         fastcgi_read_timeout 600s;
         fastcgi_send_timeout 600s;
     }
 
     # deny access to .htaccess files, if Apache's document root
     # concurs with nginx's one
     #
     location ~ /\.ht {
         deny  all;
     } 


    include common/locations.conf;
    include /var/www/ooriginal.com.br/conf/nginx/*.conf;


}
If you take out the "
Code:
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
    }
block, does it show same error ?

Yes, I had to modify "}" and now is working fine! Bellow is the final configuration of the file.

Thank you very much for helping.

Code:
server {

    server_name ooriginal.com.br   www.ooriginal.com.br;

    root /var/www/ooriginal.com.br/htdocs;
    
    access_log /var/log/nginx/ooriginal.com.br.access.log rt_cache;
    error_log /var/log/nginx/ooriginal.com.br.error.log;     

    
     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

     #error_page  404              /404.html;
 
     # redirect server error pages to the static page /50x.html
     #
     error_page   500 502 503 504  /50x.html;
 
     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
     #
     location ~ \.php$ {
         fastcgi_split_path_info  ^(.+\.php)(.*)$;
 
         fastcgi_param  PATH_INFO        $fastcgi_path_info;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include fastcgi_params;
 
         fastcgi_pass   127.0.0.1:9000;
         fastcgi_index  index.php;
 
         fastcgi_read_timeout 600s;
         fastcgi_send_timeout 600s;
     }
 
     # deny access to .htaccess files, if Apache's document root
     # concurs with nginx's one
     #
     location ~ /\.ht {
         deny  all;
     }   

    include common/php.conf;
    include common/locations.conf;
    include /var/www/ooriginal.com.br/conf/nginx/*.conf;
}
 
Can anyone help me what change should I do in this default conf file?
I tried change many times and still got 404 error.

Code:
server {
listen MY_SERVER_IP:80;
server_name antik.ml www.antik.ml;
root /home/admin/web/antik.ml/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/antik.ml.log combined;
access_log /var/log/nginx/domains/antik.ml.bytes bytes;
error_log /var/log/nginx/domains/antik.ml.error.log error;

location / {

location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}

location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}

fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}

error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;

location /error/ {
alias /home/admin/web/antik.ml/document_errors/;
}

location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}

location /vstats/ {
alias /home/admin/web/antik.ml/stats/;
include /home/admin/conf/web/antik.ml.auth*;
}

include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;

include /home/admin/conf/web/nginx.antik.ml.conf*;
}

Where should I paste this?
Code:
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;
     }

All that I tried so far still making error 404.

Thank you.
 
Back
Top