简体   繁体   English

托管一个 vue js 应用程序

[英]Hosting a vue js apllication

I have a vue JS application which is working fine.我有一个运行良好的 vue JS 应用程序。 I have a domain and sub domain name for the application and I want to host it.我有应用程序的域和子域名,我想托管它。 My application is running locally but when I try to add a subdomain name to it , it shows 500 Internal server error.我的应用程序正在本地运行,但是当我尝试向其添加子域名时,它显示 500 内部服务器错误。 This is the very first time I am trying to host a website, so I don't know what I am doing wrong.这是我第一次尝试托管网站,所以我不知道我做错了什么。 My vue js config file looks like this.我的 vue js 配置文件是这样的。

const webpack = require('webpack');

module.exports = {
  lintOnSave: false,
  configureWebpack: {
    // Set up all the aliases we use in our app.
    resolve: {
      alias: {
        'chart.js': 'chart.js/dist/Chart.js'
      }
    },
    plugins: [
      new webpack.optimize.LimitChunkCountPlugin({
        maxChunks: 6
      })
    ],
    devServer:{
     disableHostCheck: true,
       host: '0.0.0.0',
       port: 8080,
       public : 'spark.innovation.com',
    },
              
  },
  pwa: {
    name:' Dashboard',
    themeColor: '#344675',
    msTileColor: '#344675',
    appleMobileWebAppCapable: 'yes',
    appleMobileWebAppStatusBarStyle: '#344675'
  },
  pluginOptions: {
    i18n: {
      locale: 'en',
      fallbackLocale: 'en',
      localeDir: 'locales',
      enableInSFC: false
    }
  },
  css: {
    // Enable CSS source maps.
    sourceMap: process.env.NODE_ENV !== 'production'
  }
};


Any advice or tips to how to solve it.有关如何解决它的任何建议或提示。 Thanks.谢谢。

By default, Vue CLI assumes your app will be deployed at the root of a domain, eg https://www.my-app.com/ .默认情况下,Vue CLI 假定您的应用程序将部署在域的根目录下,例如https://www.my-app.com/ If your app is deployed at a sub-path, you will need to specify that sub-path using this option.如果您的应用程序部署在子路径中,您将需要使用此选项指定该子路径。 For example, if your app is deployed at https://www.foobar.com/my-app/ , set publicPath to '/my-app/' .例如,如果您的应用程序部署在https://www.foobar.com/my-app/ ,请将publicPath设置为'/my-app/'

Morever you need to configure you web server, where you are trying to deploy you Vue app.此外,您还需要配置您的 Web 服务器,您可以在其中尝试部署 Vue 应用程序。

Reference - https://cli.vuejs.org/config/#publicpath参考 - https://cli.vuejs.org/config/#publicpath
Deployment - https://cli.vuejs.org/guide/deployment.html部署 - https://cli.vuejs.org/guide/deployment.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM