在Windows 10
问题描述:
创建的XAMPP Apache服务器V-3.2.1多个虚拟主机,我想在我的Windows 10,64位,XAMPP 3.2.1 创建多个虚拟主机,我做了以下内容:在Windows 10
1- C:\ Windows \ System32下\驱动程序\等\主机
我已在主机的底部添加了这些线文件:
127.0.0.1 smc
127.0.0.1 ocms
2- d:\ XAMPP \ apache的\ conf \ httpd.conf
虚拟主机已启用看到以下内容:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
3- d:\ XAMPP \ apache的\的conf \额外\的httpd-vhosts.conf
在这里,我已经加入
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName smc
DocumentRoot "D:/vhosts/smc"
SetEnv APPLICATION_ENV "development"
<Directory "D:/vhosts/smc/">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName ocms
DocumentRoot "D:/vhosts/ocms/"
SetEnv APPLICATION_ENV "development"
<Directory "D:/vhosts/ocms">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
最后我已经把我的两个目录在我的d:/虚拟主机/文件夹:上的httpd-vhosts.conf文件下面的代码块
D:/vhosts/ocms
D:/vhosts/smc
后,我已经重新启动我的Apache服务器和测试网址,如:
http://ocms
或者
http://smc
它返回以下错误:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
ocms
Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8
我用Google搜索它过去三到四天的时间太多了,也是foll在计算器上还欠了一些其他职位,即how to create virtual host on XAMPP,但没有运气。请让我知道我错过了什么。 谢谢
答
好吧,我已经做到了。我不得不把我所有的目录放在htdocs文件夹下。 结构应该是:
D:\xampp\htdocs
D:\xampp\htdocs\test\smc
D:\xampp\htdocs\test\ocms
谢谢大家的宝贵时间
答
你的初始设置工作对我很好。
我认为你的问题是索引不见了。
这条线将强制Apache在只接受的index.php文件作为切入点:
DirectoryIndex index.php
但是,如果你的入口点有不同的名称或扩展你的错误:
You don't have permission to access the requested directory. There is either no index document or the directory is read-protecte