在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue項目 部署到服務(wù)器遇到的問題

vue項目 部署到服務(wù)器遇到的問題

我想用wamp運行我的vue項目 之前npm run build之后我把dist下的static和index.html放到了wamp的www目錄根目錄下 然后通過localhost是可以訪問的 現(xiàn)在不知道是怎么了 就是訪問不了 總是說loclhost拒絕請求
是我的config里的index.js配置不對還是wamp里的Apache配置不對呀
這是config里的index.js文件配置 我給assetsPublicPath改成了./也不行
'use strict'
// Template version: 1.2.3
// see http://vuejs-templates.github... for documentation.

const path = require('path')

module.exports = {
dev: {

// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},

// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 3000, // can be overwritten by process.env.HOST, if port is in use, a free one will be determined
autoOpenBrowser: true,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

showEslintErrorsInOverlay: false,



cssSourceMap: false,

},

build: {

// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),

// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',


productionSourceMap: false,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',


productionGzip: false,
productionGzipExtensions: ['js', 'css'],


bundleAnalyzerReport: process.env.npm_config_report

}
}

這是apache里的httpd.conf文件 里面有這部分代碼應(yīng)該就是改端口號的 我改成了8080或者3000也不行圖片描述

這是apache里的httpd.vhosts.conf里的代碼 顯示了我的項目路徑
圖片描述
下面是wamp的www目錄
圖片描述

回答
編輯回答
怣痛

localhost拒絕請求 !
哪就和你的js和html 一點關(guān)系都沒有了,你服務(wù)器問題,
檢查日志文件,去找一下原因

把配置文件改成如下試試

<VirtualHost 127.0.0.1>
    DocumentRoot "F:/git/vue-pc"
    ServerName 127.0.0.1
    <Directory "F:/git/vue-pc">
        Options FollowSymLinks Indexes
        AllowOverride All
        Order deny,allow
        Allow from 127.0.0.1
        Deny from all
        Require all granted
    </Directory>
</VirtualHost>

如果還是不行的話,打開apache 的日志,查問題,和VUE是沒有關(guān)系的現(xiàn)在

2017年12月7日 00:32
編輯回答
尛曖昧

扯了半天,把你的報錯信息粘出來啊...
只能猜測 你是不是用了mode:history?用了的話要redirect

2018年7月2日 16:19