Flarum site xml returns 404

I have searched the forum for similar issues

on

This category is for issues regarding specific apps, NOT general issues with YunoHost.

on

This form is written in English :uk: but feel free to write in French :fr: if you’re more comfortable!

on

What type of hardware are you using

VPS bought online

What YunoHost version are you running

11.2.30.2

What app is this about

flarum

Describe your issue

I added
‘’’
location = /sitemap.xml {
try_files $uri $uri/ /index.php?$query_string;
}
‘’’
to etc/nginx/sites-available/default.conf
and run ’ sudo nginx -s reload’
according to Sitemap problem - Flarum Community

but my sitemap https:livecan.net/sitemap.xml still shows 404

Can anyone please help me with this?

Thanks.

Share relevant logs or error messages

Not applicable

Try on the /etc/nginx/conf.d/DOMAIN.TLD.d/flarum.conf file. Replace the domain accordingly to your setup.

Thanks for your reply.

I added it in the flie you suggested.

    location ~* \.php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php8.2-fpm-flarum.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
        fastcgi_index index.php;
        fastcgi_read_timeout 600;
    }

location = /sitemap.xml {
try_files $uri $uri/ /index.php?$query_string;
}

    # Expire rules for static content
    location ~* \.(?:manifest|appcache|html?|xml|json)$ {
      more_set_headers "Cache-Control: max-age=0";
    }

Then restarted nginx, but it still returns with 404.

by the way, I did not see any sitemap.xml in the public nor in the assets folder. Could this has something to do with the 404?

I actually see no mention of sitemaps in Flarum’s core code: Code search results · GitHub

I think you need to install an extension, FoF Sitemap - Flarum Community. This thread actually mentions the bit of NGINX config you have tried. Carefully read the Modes paragraph to choose the right sitemap generation method.

The app’s documentation is currently not quite up to date, now you can install that extension by following these commands:

sudo su
yunohost app shell flarum
# it will open a new shell
php composer.phar require fof/sitemap

Thanks very much for your reply.

I believe you are right, and I already installed FoF Sitemap extension.

and added the following script to your suggested file, following the suggestion from the github doc.

If you are using nginx and accessing /sitemap.xml results in an nginx 404 page, you can add the following rule to your configuration file, underneath your existing location rule:

location = /sitemap.xml {
    try_files $uri $uri/ /index.php?$query_string;
}

This rule makes sure that Flarum will answer the request for /sitemap.xml when no file exists with that name.

Here is the screenshot of my nginx config file : /etc/nginx/conf.d/DOMAIN.TLD.d/flarum.conf

I believe I did everything right, and nginx server has been restarted.

Yet, my sitemap https:livecan.net/sitemap.xml still shows 404.

Sorry, I really got no clue on this one. But have to ask you for help.

PS. I have other flarum sites installed on cPanel, and the sitemaps are accessible.

Have you enabled the extension in Flarum’s admin panel?

Additionally, you should double the slash before index.php (cf. comment starting by Bug further above in the file).

Example with a subpath:
{47C03B85-124F-471F-B1F4-28F2BA7C5189}

1 Like

Yes. Thanks for your thoughtfulness.

This does the trick. Now the sitemap is accessiable now.

I really appreciate your help and your patience. :tulip:

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.