503 由于维护停机或容量问题,服务器暂时无法处理您的请求。请稍后再试。 nuxt js

我的网站运行良好,然后我更新了 nuxt.config.js 。然后,网站开始显示 Service Unavailable

我正在使用 pm2 启动/部署应用程序。它的 vps 服务器带有 apache。

它的显示:

Service Unavailable 由于维护停机或容量问题,服务器暂时无法满足您的请求。请稍后再试。

但是,如果我运行 npm run dev 站点加载正常,没有任何问题。另外,我用 pm2 list 检查了状态,它显示应用程序在线。

我的 package.json

{
  "name": "nuxtjs",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt --hostname domain.link --port 49000",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "deploy": "pm2 start npm --name nuxtjs -- start"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.13.6",
    "@yeger/vue-masonry-wall": "^3.0.16",
    "core-js": "^3.19.3",
    "nuxt": "^2.15.8",
    "pm2": "^5.1.2",
    "vue": "^2.6.14",
    "vue-server-renderer": "^2.6.14",
    "vue-template-compiler": "^2.6.14",
    "webpack": "^4.46.0"
  },
  "devDependencies": {},
  "config": {
    "nuxt": {
      "host": "0.0.0.0",
      "port": "49000"
    }
  }
}

我的 nuxt.config:

import { join } from "path";
export default {
  target: "static",
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: "Project Title",
    htmlAttrs: {
      lang: "en",
    },
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      { hid: "description", name: "description", content: "" },
      { name: "format-detection", content: "telephone=no" },
      { property: "og:title", content: "Project Title" },
      {
        property: "og:image",
        content: "https://lovealabradoodle.com/images/two.jpg",
      },
      {
        property: "og:description",
        content:
          "Content here",
      },
    ],
    link: [
      { rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
      {
        rel: "stylesheet",
        href: "https://fonts.googleapis.com/css?family=Roboto:400,600,700%7CMontserrat:400,500,600,700",
      },
      {
        rel: "stylesheet",
        href: "https://use.fontawesome.com/releases/v5.15.4/css/all.css",
      },
      {
        rel: "stylesheet",
        href: join("/", `fonts/flaticon/flaticon.css`),
      },
      {
        rel: "stylesheet",
        href: join("/", `css/bootstrap.min.css`),
      },
      {
        rel: "stylesheet",
        href: join("/", `css/plugins.css`),
      },
      {
        rel: "stylesheet",
        href: join("/", `css/magnific-popup.css`),
      },
      {
        rel: "stylesheet",
        href: join("/", `css/aos.css`),
      },
      {
        rel: "stylesheet",
        href: join("/", `css/style.css`),
      },
      {
        rel: "stylesheet",
        href: join("/", `css/styles/maincolors.css`),
      },
    ],
    script: [
      // {
      //   src: "js/jquery.min.js",
      //   body: true,
      // },
      {
        src: join("/", `js/bootstrap.bundle.min.js`),
        body: true,
      },
      {
        src: join("/", `js/imagesloaded.pkgd.min.js`),
        body: true,
      },
      {
        src: join("/", `js/isotope.pkgd.min.js`),
        body: true,
      },
      {
        src: join("/", `js/jquery.magnific-popup.min.js`),
        body: true,
      },
      {
        src: join("/", `js/easing.min.js`),
        body: true,
      },
      {
        src: join("/", `js/aos.js`),
        body: true,
      },
      {
        src: join("/", `js/custom-nuxt.js`),
        body: true,
      },
    ],
    bodyAttrs: {
      id: "top",
    },
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    // "~/static/css/bootstrap.min.css",
    // "~/static/css/plugins.css",
    // "~/static/css/magnific-popup.css",
    // "~/static/css/aos.css",
    // "~/static/css/style.css",
    // "~/static/css/styles/maincolors.css",
  ],
  //Global JS
  //   script: [
  // "~assets/js/custom.js"
  //   ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: {
    path: "~/components", // will get any components nested in let's say /components/test too
    pathPrefix: false,
  },

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    "@nuxtjs/axios",
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
    baseURL: "http://api.domain.link/api",
    retry: { retries: 3 },
  },
  publicRuntimeConfig: {
    axios: {
      baseURL: "http://api.domain.link/api",
    },
  },
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    extractCSS: true,
  },
};
stack overflow 503 The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. nuxt js
原文答案

答案:

作者头像

我运行了 yarn/npm install 它对我有用