其他分享
首页 > 其他分享> > Vue 修改默认访问地址

Vue 修改默认访问地址

作者:互联网

一、修改Vue配置文件

       ①、修改配置,修改publicPath节点即可,对应修改访问地址

/*
* vue config
* */
const fs = require('fs-extra')
module.exports = {
  lintOnSave: false,
  publicPath: '/RtcScreen/',
  devServer: {
    port: 8020,
    overlay: {
      warnings: false,
      errors: true
    },
    https: true,
    key: fs.readFileSync('./cert/key.pem'),
    cert: fs.readFileSync('./cert/cert.pem'),
    openPage: '#/?path=screenShare'
  },
  configureWebpack: config => {
    if (process.env.NODE_ENV === 'development') {
      config.devtool = 'eval-source-map'
    }
  }
}

      ②、添加web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Handle History Mode and custom 404/500" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="/RtcScreen/" /> <!--这里对应修改访问地址-->
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

 

标签:Vue,false,pem,地址,默认,修改,cert,fs,config
来源: https://www.cnblogs.com/study10000/p/15923158.html