本文介绍了如何在阿帕奇(XAMPP)服务器子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的本地的XAMPP安装一段时间来创建子域。
我试图编辑我的httpd.conf文件和我进了以下内容:

Hey guys I've trying to create subdomain in my local xampp installation for some time.I tried editing my httpd.conf file and I entered the following:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /ecommerce
ServerName ecomm.localhost
</VirtualHost>

我还编辑我的Windows主机文件并输入:
127.0.0.1 ecomm.localhost

I also edited my windows hosts file and entered:127.0.0.1 ecomm.localhost

但是,当我输入我的Firefox'ecomm.localhost它给了我:
禁止访问!
可以请人帮助我。究竟我做错了。我是相当新了这一点。
我只是想在我的的htdocs文件夹中创建文件夹多张,并与子域使用它们作为不同的网站。例如:
C:\\ XAMPP \\ htdocs中\\ mainSite -----> mainSite.com或mainSite.localhost
C:\\ XAMPP \\ htdocs中\\子网站-----> subSite.mainSite.com或subSite.mainSite.localhost

But when I type 'ecomm.localhost' in my firefox it gives me:Access forbidden!!!Can please anybody help me out. What exactly I'm doing wrong. I'm fairly new to this.I simply want to create mulitple folders in my 'htdocs' folder and use them as different websites with subdomain. For example:c:\xampp\htdocs\mainSite -----> mainSite.com or mainSite.localhostc:\xampp\htdocs\subSite -----> subSite.mainSite.com or subSite.mainSite.localhost

任何帮助将是非常美联社preciated。

Any help would be really appreciated.

推荐答案

试试这个:结果

NameVirtualHost 127.0.0.1:80
<VirtualHost *:80>
<Directory "C:\path\to\ecommerce">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
</Directory>
ServerName ecomm.localhost
ServerAlias www.ecomm.localhost
DocumentRoot "C:\path\to\ecommerce"
</VirtualHost>

是您编辑您的主机文件正确。结果

Yes you edited your hosts file correctly.

这篇关于如何在阿帕奇(XAMPP)服务器子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 21:51