VirtualHost on XAMPP

荒凉一梦 提交于 2019-12-30 05:34:07

问题


I'm using XAMPP lite on Windows 7, but instead of http://localhost I'd like to have http://mycustomname mapped to a directory myfolder in root/htdocs.

What should I change in httpd.conf?

Many thanks!


回答1:


Add to your xampp\apache\conf\extra\httpd-vhosts.conf file:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName mycustomname
    ServerAlias mycustomname
    DocumentRoot "c:\xampp\htdocs\myfolder"
</VirtualHost>

Now edit c:\windows\system32\drivers\etc\hosts and add a new line:

127.0.0.1        mycustomname

Which will cause Windows to resolve your custom name to 127.0.0.1. Restart Apache and you can access your site.



来源:https://stackoverflow.com/questions/3947796/virtualhost-on-xampp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!