如何在Windows7上的xampp中创建虚拟主机

如何在Windows7上的xampp中创建虚拟主机,xampp,Xampp,如何在Windows7上的xampp中创建虚拟主机 我首先在C:\XAMPP安装XAMPP\ 我想打电话给网站http://localhost/mywebsite至http://mywebsite.localhost.com在我的电脑中。是的,这是可能的。您需要的配置类似于: <VirtualHost *:80> ServerName mywebsite.localhost.com DocumentRoot C:\your\web\folder </Virtua

如何在Windows7上的xampp中创建虚拟主机

我首先在C:\XAMPP安装XAMPP\


我想打电话给网站
http://localhost/mywebsite
http://mywebsite.localhost.com
在我的电脑中。

是的,这是可能的。您需要的配置类似于:

<VirtualHost *:80>
    ServerName mywebsite.localhost.com
    DocumentRoot C:\your\web\folder
</VirtualHost>

ServerName mywebsite.localhost.com
DocumentRoot C:\your\web\folder
您需要将其附加到现有配置中,或者创建一个新的配置文件并从主配置文件中包含它

如果文件
C:/xampp/apache/conf
包含来自xampp的apache指令,那么是的,它将在这里工作


确保在执行ping mywebsite.localhost.com操作时获得本地IP地址。如果您没有得到回复,这意味着您需要在
主机
文件中进行设置。

XAMPP只是幕后的Apache。你找到主配置文件了吗?它通常被称为
httpd.conf
。您可以将虚拟主机配置放在那里。您在手册中找到正确的部分了吗?您还需要将
mywebsite.localhost.com
添加到您的
hosts
文件中,将其别名为
127.0.0.1
-您完成了吗?1。(XAMPP中的Apache)我可以在这里进行配置吗(C:/XAMPP/Apache/conf)2。mywebsite.localhost.com我想测试一下这个网站,我认为它很容易在我的书签中收集。谢谢。成功了!和mywebsite.localhost.com,在C:\Windows\System32\drivers\etc添加新行127.0.0.1 mywebsite.localhost.com