Skip to content

magento with nginx not found page show as defualt one with one magento html

when i type any invlaid url it shows like below

enter image description here

instead i want to show my website page

current setting of nginx.conf (in magento root folder)

root $MAGE_ROOT/pub;
index index.php;
autoindex off;
charset UTF-8;
error_page 404 403 = /errors/404.php;
#add_header "X-UA-Compatible" "IE=Edge";

i tried changing it and

root $MAGE_ROOT/pub;
index index.php;
autoindex off;
charset UTF-8;
error_page 404 403 = https://example.com/no-route;
#add_header "X-UA-Compatible" "IE=Edge";

then it directed me to that url , i do not want redirect it show show not found message on that url only please help me with what

Magento code base : /usr/share/nginx/html/m1

Server Nginx Setting

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  localhost;
        # root         /usr/share/nginx/html/m1;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        set $MAGE_ROOT /usr/share/nginx/html/m1;
        include /usr/share/nginx/html/m1/nginx.conf;

        #location / {
        #}

        # redirect server error pages to the static page /40x.html
        #
        error_page 404 /404.html;
            location = /40x.html {
        }

        # redirect server error pages to the static page /50x.html
        #
        #error_page 500 502 503 504 /50x.html;
        #    location = /50x.html {
        #}


        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ .php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ .php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi_params;
        }


        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /.ht {
        #    deny  all;
        #}
    }

Magento folder nginx.conf

index index.php;
autoindex off;
charset UTF-8;
error_page 404 403 = /errors/404.php;
#add_header "X-UA-Compatible" "IE=Edge";