简体   繁体   中英

Hosting a vue js apllication

I have a vue JS application which is working fine. 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. 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.

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/ . 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/' .

Morever you need to configure you web server, where you are trying to deploy you Vue app.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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