虚拟主机重定向到localhost
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了虚拟主机重定向到localhost相关的知识,希望对你有一定的参考价值。
我有问题用XAMMP创建虚拟主机。虚拟主机始终重定向到localhost。例如,当我键入mysite.local将重定向到localhost / mysite。下面是我的主机和apache配置:
- etc / hosts文件
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.0.1 mysite.local
- /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf
NameVirtualHost *:80 # localhost <VirtualHost *:80> ServerName localhost DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" </VirtualHost> <VirtualHost *:80> ServerName mysite.local ServerAlias mysite.local *.lancome.local DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mysite" <Directory "/Applications/XAMPP/xamppfiles/htdocs/mysite"> Options Indexes FollowSymLinks Includes execCGI AllowOverride All Require all granted </Directory> </VirtualHost>
答案
1)D: xampp apache conf extra httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/webshop_moscow/trunk"
ServerName bos.webshop.local
<Directory "D:/xampp/htdocs/webshop_moscow/trunk">
# Order allow,deny
# Allow from all
Require all granted
</Directory>
</VirtualHost>
2)C: Windows System32 drivers etc.
127.0.0.1 bos.webshop.local
以上是关于虚拟主机重定向到localhost的主要内容,如果未能解决你的问题,请参考以下文章