我试图重定向到我的本地主机上的网页,我已经从我的主机文件和 v-hosts 中完成了所有必要的配置,它从我的 C:\Windows\System32\drivers\etc 主机文件中获取我的地址,这是名称。本地但不显示主页。请记住,该站点具有前端和后端访问权限。我是新手,想在本地处理我的应用程序,然后才能开始在服务器上编辑它。
问问题
224 次
1 回答
0
您发布了包含您的虚拟主机定义和主机文件内容的附加评论
v-host file
<VirtualHost 127.0.0.1:80>
DocumentRoot "c:/xampp/htdocs/intranet"
ServerName gep.local
ServerAlias gep.local
CustomLog "c:gep.local-access_log" combined
ErrorLog "c:gep.local-error_log"
<Directory "c:/xampp/htdocs/intranet">
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
host file:
127.0.0.1 gep.local
这里有一些建议:-
您是否重新启动或重新启动 DNS 客户端以激活您的 HOSTS 文件更改。
from a command window run started using 'Run as Administrator' do this
net stop "DNS Client"
then once it reports as STOPPED
net start "DNS Client"
这将刷新 Windows DNS 缓存。(由于服务名称中有空格,所以需要双引号)
首先更改<VirtualHost 127.0.0.1:80>
为<VirtualHost *:80>
如果您使用的是 Apache 2.2.x,您还需要一个NameVirtualHost *:80
参数作为 vhost 定义文件中的第一个参数。如果您使用的是 Apache 2.4.x,我相信他们删除了此要求,因此在该版本的 Apache 上没有必要。
所以
new v-host file
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/intranet"
ServerName gep.local
ServerAlias gep.local
CustomLog "c:/gep.local-access_log" combined
ErrorLog "c:/gep.local-error_log"
<Directory "c:/xampp/htdocs/intranet">
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
然后当然要测试它,使用浏览器地址栏中的地址“ http://gep.local ”来访问这个新的虚拟主机。
于 2013-08-14T11:07:47.390 回答