Google Search Console, Next.js 14.2.15. Issue with the 404 page
Google Search Console reports: Not Found (404) These pages are not indexed or included in Google.
The page is located in the root of the project and is named not-found.js. Here is the code:
import NotFoundPage from "@/components/404/NotFoundPage";
const NotFound = () => {
return (
<NotFoundPage />
);
};
export default NotFound;
Status code check in the browser: Status Code: 404 Not Found
The project is deployed on a VPS using Docker, Certbot, and NGINX.
NGINX Configuration:
server {
listen 443 ssl;
server_name domain.com www.domain.com;
root /usr/share/nginx/html;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
set $need_redirect "0";
if ($host ~* ^www\.(.*)$) {
set $need_redirect "1";
}
if ($request_uri ~* "well-known") {
set $need_redirect "0";
}
if ( $need_redirect ~ "1") {
return 301 https://$server_name$request_uri;
}
location / {
proxy_pass http://frontend:1010/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
error_page 502 504 = @fallback;
}
location @fallback {
root /usr/share/nginx/html;
try_files /errorpage.html =502;
}
}