Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
by Rookie

I installed a new WordPress site and the RankMath sitemap was not showing (NGINX 404).

It was a custom WordPress install:

sudo site example.com -wp=[true,true,localhost,example_com,example_user,random,xy_] -cache=on

I went through the change logs and saw that from v1.12.0 on, Yoast sitemap support is disabled by default.

I searched the documentation with the search terms "yoast" and "sitemap" but could not find any command to enable Yoast sitemap support. 

Is there a command to enable Yoast sitemap support?

If not, here is my solution for anybody who has the same problem:

$ sudo nano /etc/nginx/sites-available/example.com
# Insert this line under # WebinolyCustom
include common/yoast-sitemap.conf;
# Save the file
$ sudo nginx -t && sudo service nginx reload

by Expert

Just for the record: I have found the root cause of this issue.

The XML extension was added as a static file in Webinoly configuration causing issues when this file is dynamically generated as is the case in WordPress.

This issue was introduced in Webinoly v1.17.0 and it will be fixed in the next release v1.17.2.

In the meantime it can be easily fixed just by removing the XML extension from the list, here:

  • Here: /opt/webinoly/templates/nginx/common/header.conf
  • And here: /opt/webinoly/templates/nginx/common/headers.conf
  • Run: sudo webinoly -server-reset=nginx to changes take effect.
Sorry for the inconvenience!

1 Answer

0 votes
by Expert

Yoast support was removed a long time ago!

The file you are suggesting as a solution does not exist anymore (unless you have a very old installation).

The Nginx rules for Yoast are not needed anymore, sitemaps should be working without any additional modification.

In case you need to add any custom Nginx conf, just read the documentation to not break any current configuration.

by Rookie

Thank you for your answer!

The installation of Webinoly on this server was in April/May 2021. But I copied some older websites over from another server. The last website I copied over was created in Nov 2020, and it still has the "include common/yoast-sitemap.conf;" in the file.

The file I changed (/etc/nginx/sites-available/example.com) does exist - even for the site I created in January 2023. Also, the yoast-sitemap.conf file exists on my server.

Anyway, the sitemaps from 2 websites I created in July 2022 and January 2023 did not work as of today. I saw it in Google Search Console and manually checked it. Maybe the sitemap from the site I created in July 2022 was working at some time - I did not check it before today. The sitemaps from my older websites all work. And after adding the line as described above, the sitemaps worked.

I do not need any custom Nginx conf, but just the sitemaps. 

So, either with my "old" installation of Webinoly, sitemaps are not working without adding the line I described above, or the way I created the websites (sudo site example.com -wp=[]) breaks the sitemap support.

How can I further investigate this issue? 

by Expert

Not even Yoast knows how to investigate this issue surprise

Not kidding, read: https://twitter.com/jdevalk/status/1163174358111662080

by Rookie
Nice answer from Yoast :-)

I use RankMath - and there was this problem today. There were 2 sites with this problem, at least 2 other without that problem on the same Webinoly installation.

What do you recommend when I create a new site on that server and sitemaps do not work? Should I follow my suggestion from above? Or any other modifications?
by Expert
Use the old file, and for new installations you can add the Nginx rules following the Webinoly documentation: https://webinoly.com/documentation/sites/#nginx
by Rookie

Thank you very much!

I just created 3 new WordPress sites on 2 different servers (but both servers with the same configuration). I installed RankMath and the sitemap did not work.

I then created a custom-nginx.conf file for every site with the code from RankMath:

# START Nginx Rewrites for Rank Math Sitemaps
 rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
 rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
 # END Nginx Rewrites for Rank Math Sitemaps

Now, the sitemaps of all 3 sites work!

Thank you very much for your help!

by Rookie

Even better: I put the RankMath code here:

sudo nano /etc/nginx/conf.d/rankmath.conf.srv

So, I don't have to do custom Nginx rules for every new site on my old installation. 

Just wondering if I'm the only one with this "problem"?

by Rookie
This solutions way better.

I have hundreds site to be managed and this feature removed made a headache. I dont want to add custom rules on each site conf.
Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.