vue-cli启动的webpack项目设置https协议

不需要什么https协议证书

修改访问地址为IP访问(自己的IP)

//文件 config/index.js
host: '172.180.23.56', //自己IP

在这里插入图片描述

//文件build/webpack.dev.conf.js
devServer: {
    clientLogLevel: 'warning',
    historyApiFallback: {
      rewrites: [
        { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
      ],
    },
    -----------这里-------------
    https:true, //添加https为true
    -----------这里-------------
    hot: true,
    contentBase: false, // since we use CopyWebpackPlugin.
    compress: true,

在这里插入图片描述
在这里插入图片描述
启动项目会提示不是安全的访问连接地址,没关系,本地的项目,直接继续访问,不需要返回安全链接
不需要什么SSL证书,个人生成的证书同样会提示不安全,或者未认证,那还不如简单粗暴一点,直接这样干就行

猜你喜欢

转载自blog.csdn.net/qq_38652871/article/details/89457740