如何创建XAMPP虚拟主机 [英] how to create virtual host on XAMPP
问题描述
我相信这个问题被问了很多次,但我不是一个问题遇到的问题。我使用的XAMPP其中i配置Zend框架。
XAMPP是在端口运行8081 为 80 被一些窗口过程中,我需要使用虚拟主机,我有以下的code配置占据< STRONG>的httpd-vhosts.config $ p $在psent C:/ XAMPP /阿帕奇/配置/额外/
&LT;虚拟主机*:80&GT;
服务器名COMM-app.local
的DocumentRootC:/ XAMPP / htdocs中/ CommunicationApp /公
SETENV APPLICATION_ENV发展
&LT;目录C:/ XAMPP / htdocs中/ CommunicationApp /公
的DirectoryIndex index.php文件
所有的AllowOverride
为了允许,拒绝
所有允许
&LT; /目录&GT;
&LT; /虚拟主机&GT;
和也更新主机与文件的 127.0.0.1 COMM-app.local 并尝试重新启动Apache,但它显示错误。
15时03分01秒[阿帕奇]错误:Apache的意外关闭。
15时03分01秒[阿帕奇]这可能是由于阻塞端口,缺少的依赖,
15时03分01秒[阿帕奇]不当特权,崩溃,或者通过其他方法关闭。
15时03分01秒[阿帕奇] preSS日志按钮来查看错误日志和检查
15时03分01秒[阿帕奇] Windows事件查看器的更多线索
15时03分01秒[阿帕奇]如果你需要更多的帮助,复制和发布此
15时03分01秒[阿帕奇]在论坛上整个日志窗口
我看到了两个错误:
&LT;虚拟主机*:80&GT; - &GT;修复了:8081,你的端口的服务器上运行
服务器名COMM-app.local
的DocumentRootC:/ XAMPP / htdocs中/ CommunicationApp /公
SETENV APPLICATION_ENV发展
&LT;目录C:/ XAMPP / htdocs中/ CommunicationApp / PUBLIC - &GT;这可能是为什么它崩溃,失踪&GT;
的DirectoryIndex index.php文件
所有的AllowOverride
为了允许,拒绝
所有允许
&LT; /目录&GT;
- &GT;缺少结束容器:LT; /虚拟主机&GT;
修正版本:
&LT;虚拟主机*:8081&GT;
服务器名COMM-app.local
的DocumentRootC:/ XAMPP / htdocs中/ CommunicationApp /公
SETENV APPLICATION_ENV发展
&LT;目录C:/ XAMPP / htdocs中/ CommunicationApp /公众&GT;
的DirectoryIndex index.php文件
所有的AllowOverride
为了允许,拒绝
所有允许
&LT; /目录&GT;
&LT; /虚拟主机&GT;
有一件事要提的:
您随时可以尝试和运行命令:
服务的Apache2 configtest
这会告诉你,当你有一个畸形的配置,甚至可以告诉你问题出在哪里。
此外,它有助于避免在LIVE系统不可用:
服务的Apache2重启
将关闭,然后无法启动,这configtest你事先知道哎呀我做错了什么,我要解决这个问题首先,但在Apache本身仍与旧配置运行。 :)
I am sure this question is being asked many times but I am not encounter with a problem. I am using XAMPP where i configure Zend framework.
XAMPP is running on PORT 8081 as 80 is being occupied by some windows process I need to use Virtual host for that I configure with following code in httpd-vhosts.config present in C:/xampp/apache/config/extra/
<VirtualHost *:80>
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public"
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and also update the hosts file with 127.0.0.1 comm-app.local and try to re-start apache but it is showing error.
15:03:01 [Apache] Error: Apache shutdown unexpectedly.
15:03:01 [Apache] This may be due to a blocked port, missing dependencies,
15:03:01 [Apache] improper privileges, a crash, or a shutdown by another method.
15:03:01 [Apache] Press the Logs button to view error logs and check
15:03:01 [Apache] the Windows Event Viewer for more clues
15:03:01 [Apache] If you need more help, copy and post this
15:03:01 [Apache] entire log window on the forums
I see two errors:
<VirtualHost *:80> -> Fix to :8081, your POrt the server runs on
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public" -> This is probably why it crashes, missing >
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
-> MIssing close container: </VirtualHost>
Fixed version:
<VirtualHost *:8081>
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/CommunicationApp/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
One thing to mention:
You can always try and run command:
service apache2 configtest
This will tell you when you got a malformed configuration and maybe even can tell you where the problem is.
Furthermore it helps avoid unavailability in a LIVE system:
service apache2 restart
will shutdown and then fail to start, this configtest you know beforehand "oops I did something wrong, I should fix this first" but the apache itself is still running with old configuration. :)
这篇关于如何创建XAMPP虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!