404 not found for sitemap.xml

OysterD3
0
OysterD3
commented 21 days ago

Here is the link to sitemap: https://journey.com.my/sitemap.xml
I am using Nginx, should I set anything on Nginx configuration?

0
NicoPennec
1.7k
NicoPennec
commented 18 days ago

hi @OysterD3
It's a HTTP 500 "Server error".
Please check your error logs, and share the error stack trace

0
OysterD3
0
OysterD3
commented 9 days ago

Hi @NicoPennec, please check out https://vtapau.com/sitemap.xml
It is fine if I run npm run build && npm run start on local

0
NicoPennec
1.7k
NicoPennec
commented 8 days ago

Can you share your sitemap config, please?
And give me more details to reproduce? like nuxt version, build mode (ssr, spa, generate, …), sitemap-module version, …

0
OysterD3
0
OysterD3
commented 7 days ago

Hi @NicoPennec, here is my nuxt.config.js
Running with nuxt v2.12.0, sitemap-module v2.1.0, ssr

import path from "path";
import axios from "axios";

require("dotenv").config();

module.exports = {
  mode: "universal",
  server: {
    port: 8081
  },
  /*
   ** Headers of the page
   */
  head: {
    titleTemplate: `%s | VTapau`,
    title: "VTapau",
    meta: [
      { charset: "utf-8" },
      { name: "theme-color", content: "#FE7234" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      {
        name: "description",
        content:
          "Explore Malaysia's F&B outlets + grocery stalls in ONE place | The largest tapau & delivery platform for restaurants and grocery shops in Malaysia"
      },
      {
        hid: "og:image",
        property: "og:image",
        content: "/og-image.png"
      },
      {
        hid: "twitter:image",
        property: "twitter:image",
        content: "/og-image.png"
      }
    ],
    script: [
      {
        async: true,
        pbody: true,
        defer: true,
        src: "https://connect.facebook.net/en_US/sdk.js"
      }
    ],
    link: [
      { rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
      {
        href: `https://fonts.googleapis.com/css?family=Lato:300,400,700,900|Montserrat:700&display=swap`,
        rel: "stylesheet"
      },
      {
        rel: "stylesheet",
        href:
          "https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"
      }
    ]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: "#fff" },
  /*
   ** Global CSS
   */
  css: ["@/assets/styles/global.scss"],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    { src: "@/plugins/breakpoint", mode: "client" },
    { src: "@/plugins/axios", mode: "client" },
    { src: "@/plugins/vue-awesome-swiper.js", mode: "client" },
    { src: "@/plugins/vue-clipboard2", mode: "client" },
    { src: "@/plugins/vue-google-maps", mode: "client" },
    { src: "@/plugins/fb-sdk", mode: "client" }
  ],
  env: {
    apiUrl:
      process.env.NODE_ENV === "development"
        ? "http://localhost:8000/api/v1"
        : "https://listing-stg-back.journey.com.my/api/v1"
  },
  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [
    "@nuxtjs/vuetify",
    [
      "@nuxt/typescript-build",
      {
        typeCheck: {
          memoryLimit: 4096,
          workers: 2
        }
      }
    ],
    "@nuxtjs/dotenv",
    "@nuxtjs/gtm"
  ],
  /**
   * Google Tag Manager
   */
  gtm: {
    id: ""
  },
  /*
   ** Nuxt.js modules
   */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    "@nuxtjs/axios",
    // Doc: https://github.com/nuxt-community/dotenv-module
    "@nuxtjs/dotenv",
    "@nuxtjs/gtm",
    [
      "@nuxtjs/device",
      {
        defaultUserAgent:
          "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.39 Mobile Safari/537.36"
      }
    ],
    "@nuxtjs/robots",
    "@nuxtjs/sitemap"
  ],
  /**
   * i18n https://nuxt-community.github.io/nuxt-i18n/
   */
  // i18n: {
  //   locales: [
  //     {
  //       code: "en",
  //       file: "en-US.ts"
  //     },
  //     {
  //       code: "zh",
  //       file: "zh-CN.ts"
  //     }
  //   ],
  //   defaultLocale: "en",
  //   lazy: true,
  //   langDir: "lang/"
  // },
  /**
   * Robot.txt
   * See https://www.npmjs.com/package/@nuxtjs/robots
   */
  robots: {
    UserAgent: "*",
    Disallow: ["/user", "/login", "/signup", "/auth"],
    Sitemap: "https://vtapau.com/sitemap.xml"
  },
  /**
   * Sitemap
   * See https://www.npmjs.com/package/@nuxtjs/sitemap
   */
  sitemap: {
    exclude: ["/user/**", "/auth", "/login", "/signup"],
    hostname: "https://vtapau.com",
    routes: async () => {
      const { data } = await axios.get(
        `https://listing-stg-back.journey.com.my/api/v1/property/`
      );
      return data.map((el) => `/property/${el.id}`);
    }
  },
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {
    baseURL:
      process.env.NODE_ENV === "development"
        ? "http://localhost:8000/api/v1"
        : "https://listing-stg-back.journey.com.my/api/v1"
  },
  router: {
    middleware: ["getUser"]
  },
  /*
   ** vuetify module configuration
   ** https://github.com/nuxt-community/vuetify-module
   */
  vuetify: {
    customVariables: ["./assets/variables.scss"],
    defaultAssets: {
      font: {
        family: "Lato",
        icons: "fa"
      }
    },
    theme: {
      light: true,
      themes: {
        light: {
          primary: "#FE7235",
          secondary: "#FFA45B",
          info: "<a href="https://github.com/nuxt-community/sitemap-module/issues/909399" target="_blank">#909399</a>",
          warning: "#E6A23C",
          error: "#e86c74",
          success: "#8aa27d",
          cream1: "#FAF3EB"
        }
      }
    }
  },
  /*
   ** Build configuration
   */
  build: {
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {
      config.resolve.alias["~desktop"] = path.join(
        path.resolve("./components"),
        "Desktop"
      );
      config.resolve.alias["~mobile"] = path.join(
        path.resolve("./components"),
        "Mobile"
      );
    },
    transpile: [/^vue2-google-maps($|\/)/],
    babel: {
      plugins: [
        ["@babel/plugin-proposal-decorators", { legacy: true }],
        ["@babel/plugin-proposal-class-properties", { loose: true }]
      ]
    }
  }
};
0
NicoPennec
1.7k
NicoPennec
commented 7 days ago

Thanks your sitemap config is good.
So your issue probably comes from your Nginx reverse proxy config.

can you share it this config?

eg. of valid config:

  location / {
       proxy_pass http://localhost:8081/;
  }
0
OysterD3
0
OysterD3
commented 7 days ago

Hi @NicoPennec, here is the nginx config

server {
        listen 80;
        server_name vtapau.com www.vtapau.com;
        index index.html index.php;

        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;
        }
}
0
NicoPennec
1.7k
NicoPennec
commented 4 days ago

This configuration is for http (listen 80), but no https (listen 443).

If it works on local, but not on production, it is likely the issue is it is likely in your server configuration. Check your nginx logs (access and error) please.

Note that you use the "@nuxtjs/robots", but your https://vtapau.com/robots.txt fails in 404 error too…

Can you share your pages/ folder structure? because I see some strange redirection (eg. "/" redirect to "food/")?

Another point, on localhost, have your try with "npm run dev"? or with "npm run build && npm run start"?

0
OysterD3
0
OysterD3
commented 4 days ago

I have disabled auto redirection https on cloudflare.

No access and error log printed when access /sitemap.xml

I don't have a landing page, so I put a middleware at index.vue to redirect to "/food"

On localhost I tried both npm run dev and npm run build && npm run start

It is working.

0
OysterD3
0
OysterD3
commented 4 days ago

Hi @NicoPennec, I have checked again. Here is the log and I have added listen 443
Because for @nuxtjs/robots it has to run with generate I didn't do so.

 - - [05/Apr/2020:15:08:59 +0000] "GET /sitemap.xml HTTP/1.1" 404 34695 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
- - [05/Apr/2020:15:09:00 +0000] "GET /sitemap.xml HTTP/1.1" 404 34695 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
0
Informations
QuestionUnresolved
#c84 - Created 21 days ago