一、 Apache多站点配置方法

1、打开Apache安装目录下conf/httpd.conf文件,找到下面两行文字,把最前面的 # 号去掉,然后保存。

#LoadModule vhost_alias_module modules/mod_vhost_alias.so

#Include conf/extra/httpd-vhosts.conf

2、接着找到同一文件中的DocumentRoot和Directory,改为站点目录的上一级目录

例如站点放在 C:/XAMPP/Appserv/Web/htdocs/,则改为以下形式

A、DocumentRoot "C:/XAMPP/Appserv/Web";

B、<Directory "C:/XAMPP/Appserv/Web">;

后续各个应用可部署在此目录下。

3、上述配置完成后即可打开Apache安装目录下/conf/extra/httpd-vhosts.conf文件,在最后添加如下:

<VirtualHost *:3333>
DocumentRoot "C:/xampp/Appserv/Webhtdocs"
ServerName localhost:3333
ErrorLog "logs/localhost3333-error.log"
</VirtualHost>
<VirtualHost *:3334>
DocumentRoot "C:/xampp/Appserv/Webmall"
ServerName localhost:3334
ErrorLog "logs/Slocalhost3334-error.log"
</VirtualHost>

至此,多站点配置工作完毕。

我在配置完后,由于上述第3步的配置有问题,导致Apache服务无法启动,在Apache的Log及Windows的日志内都无法找到具体的具体的错误信息提示。

以下是我用Xampp启动Apache时的错误:

8:42:47 [main] Initializing Control Panel
8:42:47 [main] Windows Version: Windows 7 Professional 32-bit
8:42:47 [main] XAMPP Version: 1.8.3
8:42:47 [main] Control Panel Version: 3.2.1 [ Compiled: May 7th 2013 ]
8:42:47 [main] You are not running with administrator rights! This will work for
8:42:47 [main] most application stuff but whenever you do something with services
8:42:47 [main] there will be a security dialogue or things will break! So think
8:42:47 [main] about running this application with administrator rights!
8:42:47 [main] XAMPP Installation Directory: "c:\xampp\"
8:42:47 [main] Checking for prerequisites
8:42:47 [main] All prerequisites found
8:42:47 [main] Initializing Modules
8:42:47 [main] Starting Check-Timer
8:42:47 [main] Control Panel Ready
8:43:06 [Apache] Attempting to start Apache app...
8:43:06 [Apache] Status change detected: running
8:43:07 [Apache] Status change detected: stopped
8:43:07 [Apache] Error: Apache shutdown unexpectedly.
8:43:07 [Apache] This may be due to a blocked port, missing dependencies,
8:43:07 [Apache] improper privileges, a crash, or a shutdown by another method.
8:43:07 [Apache] Press the Logs button to view error logs and check
8:43:07 [Apache] the Windows Event Viewer for more clues
8:43:07 [Apache] If you need more help, copy and post this
8:43:07 [Apache] entire log window on the forums

上述错误,在度娘提供的帮助中,大都是说端口被占用,其实并不准确,最简单的办法,就是直接在CMD命令框内执行httpd.exe,此时命令框会提示具体的出错原因:

按上述提示直接解决。

Apache多站点配置及启动失败解决办法的更多相关文章

  1. APMServ5.2.6win10系统Apache、MySQL5.1启动失败解决办法

    今天想在本地测试网站源码能否正常运行,如果可以就转空间了,然而下载了APMServ之后发现系统Apache.MySQL5.1启动均失败,小白的人表示只能借助百度,用了一个小时的时间终于解决了,虽然坎坷 ...

  2. xampp搭建开源项目iwebshop后,服务器重启后再启动xampp显示组件都启动ok,但是实际启动失败解决办法

    最近用xampp搭建了开源商城项目iwebshop,刚搭建完没问题,可是周一来因为服务器重启了,我再启动xampp,显示组件都启动ok了,但是用linux命令查看相关组件的进程时,发现实际没启动起来, ...

  3. MySQL启动失败解决办法

    本人大二,进了一家培训机构学了两年,然后跟着他们做项目,其实也是练习,然后过程中遇到好多错误,当时解决了,然后下次遇到又忘了,-_-!  -_-||| 我就想通过写博客来记载一下我遇到的错误和解决的办 ...

  4. Cassandra3在Centos7下启动失败解决办法

    Centos7 安装Cassandra启动过程提示失败,查看结果如下所示: [root@xx ~]# systemctl status cassandra ● cassandra.service - ...

  5. [即时通讯]openfire启动失败解决办法

    当你发现你的电脑上的openfire无论你是重新安装还是重启都无法启动的情况下你可以按照我下面写的那些终端指令来启动你的openfire不用再去重新做你的系统了. 一般你发现你的openfire打开出 ...

  6. maven配置环境变量失败解决办法

    配置maven路径什么的统统正确,最后测hi不成功.在网上搜索了好多资料方法都解不了 具体问题具体对待吧,如果有和我类似的小伙伴,可以尝试一下我的这个办法,在maven路径后面加/bin path变量 ...

  7. ipv6禁用导致rpcbind服务启动失败解决办法

    参考文档:http://blog.51cto.com/hld1992/2055028

  8. Docker安装、命令详情、层级架构、docker服务启动失败解决方法

    容器背景: 层级架构:  容器对比传统化虚拟机: 可以把docker理解成是一款自带软件(比如:nignx.tomcat.....)的镜像操作系统(首先是要下载镜像) 以下是Windows环境安装Do ...

  9. apache多站点配置

    apache多站点配置 临时需要个测试站,然后就到apache中配置vhosts,结果这货总是显示"拒绝了你的请求",找半天发现居然还要添加端口监听 vhosts.conf 添加v ...

随机推荐

  1. ORA-01502: index 'INDEX_NAME' or partition of such index is in unusable state

    ORA-01502: index 'INDEX_NAME' or partition of such index is in unusable state 原因: 这个错误一般是因为索引状态为UNUS ...

  2. kvm虚拟机静态和动态迁移

    一.kvm虚拟机静态迁移 1.静态迁移就是虚拟机在关机状态下,拷贝虚拟机虚拟磁盘文件与配置文件到目标虚拟主机中,实现的迁移. (1)虚拟主机各自使用本地存储存放虚拟机磁盘文件 本文实现基于本地磁盘存储 ...

  3. (二)Netty源码学习笔记之服务端启动

    尊重原创,转载注明出处,原文地址:http://www.cnblogs.com/cishengchongyan/p/6129971.html  本文将不会对netty中每个点分类讲解,而是一个服务端启 ...

  4. 正则表达式 判断 ip:端口 形式

    <html> <head> </head> <body> ip:port<input type="" name="z ...

  5. 一个简单的判断浏览器是否为IE9以下的方法

    if(!-[1,]){ //是IE placeHolderIE9_(); }else{ //非IE if(navigator.userAgent.indexOf("MSIE 9.0" ...

  6. 显示或隐藏div

    代码来源于博客,如有侵权,请联系我! ASP.NET中TextBox控件设置ReadOnly="true"H或Enabled=false后台取不到值 当TextBox设置了Read ...

  7. GroupJoin和Join的声明及调用

    public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(this IEnumerable& ...

  8. runtime运行时

    /** * Describes the instance variables declared by a class. * * @param cls The class to inspect. * @ ...

  9. FPGA 开发笔记 点滴

    1.添加包含的文件或参数文件(define.v)的方式:如果文件在工程目录下的一个文件夹下,则可用 `include "../文件夹名/define.v",  文件和工程载同一目录 ...

  10. 给hadoop新手的一封信:Hadoop入门自学及对就业的帮助

    学习指南,刚接触这个确实有点懵逼,感觉还有很多东西要学要看,自己要逐渐构造成一个框架的体系. 附上一个学习博客地址: http://www.cnblogs.com/mephisto/p/4835386 ...