在xampp中设置vhost

时间:2017-05-22 04:43:04

标签: php apache vhosts

我在xampp os - windows中设置vhost时遇到了一个小问题。这是 var obj = $wilddogObject(ref); // get data from server obj.$loaded() .then(function(data) { var _extends = Object.assign || function(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var moments = _.map(data, function(val, id) { return _extends({}, val, { id: id }); }); $scope.ratePlaces = _.map(moments, function(place) { // console.log(place); if (place != null) { if (place.like != undefined) { function rating(like, favs) { var parseFavs = parseInt(favs); var parseLike = parseInt(like); var newRate = parseLike * 0.5 + parseFavs; return newRate; } place.rate = rating(place.like, place.fav_count); } } return place }) console.log($scope.ratePlaces); list($scope.ratePlaces) }) function list(r) { r.shift(); r.shift(); r.shift(); r.sort((a, b) => { if (a.rate != null || a.rate != undefined || a.rate != 'daylife' || !a.name) { return a.rate - b.rate; } else {} }) r.sort((a, b) => { if (a.rate != null || a.rate != undefined || a.rate != 'daylife' || !a.name) { let rateA = a.rate; let rateB = b.rate; if (rateA < rateB) { return -1; } if (rateA > rateB) { return 1; } return 0; } }); $scope.posts = r.reverse();

中的httpd-vhosts.conf
C:\xampp\apache\conf\extra\httpd-vhosts.conf

位于<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/yiisite/basic/web/" ServerName yiisite 位于hosts

的文件中
C:\Windows\System32\drivers\etc\hosts

所以,当我点击我得到 127.0.0.1 yiisite 我得到我想要的,但我用来在http://yiisite打开的htdocs中的所有其他文件夹都将找到找不到的yiisite模板404。无法使用localhost访问htdocs中的其他项目。如果我在vhosts.conf中更改端口,我可以访问localhost / abc但不能访问yiisite

1 个答案:

答案 0 :(得分:0)

httpd-vhosts.conf更改为

<VirtualHost 127.0.0.1:80>
 DocumentRoot "C:/xampp/htdocs/yiisite/basic/web/"
 ServerName yiisite
</VirtualHost>

解决了与htdocs内部其他项目冲突的问题,可以使用localhost/otherproject

进行访问