nginx drupal sitemap 404 not found

  • by kjohri

1.0 Error

While trying to open sitemap.xml of a site served by nginx and built using Drupal CMS, the 404 Not Found error was received. The nginx log file, error.log gave the error as, 80 open() sitemap.xml failed (2: No such file or directory).

2.0 Solution

The error was resolved by adding the following lines to the nginx configuration file, /etc/nginx/nginx.conf.

location = /sitemap.xml {
    try_files $uri @rewrite;
}

location @rewrite {
    rewrite ^/(.*)$ /index.php?q=$1;
}

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments