I am using nuxt.js sitemap-module to generate sitemap.xml
It working perfectly with npm run build && npm run start on local.
However, it won't work when it's on the cloud with Nginx. https://vtapau.com/sitemap.xml
Here is my Nginx config
server {
listen 80;
server_name vtapau.com www.vtapau.com;
location / {
proxy_pass http://localhost:8081/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_redirect off;
}
}
First of all, I really has no idea if this is valid answer to you as you mentioned you've put manually created sitemap into static folder.
I think you misconfigured the sitemap, for sitemap.xml to work, you set routes inside sitemap object:
// nuxt.config.js
{
sitemap: {
hostname: 'https://example.com',
gzip: true,
exclude: [
'/secret',
'/admin/**'
],
routes: [
'/page/1',
'/page/2',
{
url: '/page/3',
changefreq: 'daily',
priority: 1,
lastmod: '2017-06-30T13:30:00.000Z'
}
]
}
}
When I was asked to select language, I suspected that your sitemap has split into different languages. I managed to get English version sitemap here.
If your sitemap configuration is like below:
// nuxt.config.js
{
sitemap: {
hostname: 'https://example.com',
lastmod: '2017-06-30',
sitemaps: [
{
path: '/sitemap-foo.xml',
routes: ['foo/1', 'foo/2'],
gzip: true
}, {
path: '/folder/sitemap-bar.xml',
routes: ['bar/1', 'bar/2'],
exclude: ['/**']
}
]
}
}
You should able to get your sitemap at https://vtapau.com/sitemapindex.xml. I hope this is not the static xml you've created otherwise nothing I could help already. This documentation was clearly mentioned at sitemap-module, when things configured wrongly always go back to the github documentation or find answer through github issues there.
I faced exactly the same problem. I then discovered that on the production server, the Nuxt server was started using nuxt start instead of what nuxt-ts start was using locally. Which was the problem in my case. I hope this helps.
Restart your PM2 server after you run npm run build. Otherwise, the /sitemap.xml will not appear.
This has been the case for me.
My config for sitemap module:
sitemap: {
hostname: 'https://example.com',
gzip: true,
exclude: ['/exampleurl']
}