一、 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. C# WinForm实现Windows 7 Aero磨砂玻璃效果

    在Vista系统之后,微软为窗体程序提供了Aero磨砂的效果,如下图.那么用C#如 何来实现这种磨砂效果呢? 代码: using System; using System.Collections.Ge ...

  2. Docker - Install docker on CentOS

    1. 准备 由于 Dokcer 需要 64bit OS, 版本号 3.10 或者更新的版本.所以,需要我们先确认我们的 CentOS 系统 $ uname -r output :: 3.10.0-22 ...

  3. Python全栈【异常处理】

    Python全栈[异常处理] 本节内容: 1.异常处理 2.什么时候用异常处理 异常处理 1.异常处理: 异常就是程序运行时发生错误的信号,异常处理是在编程过程中为了增加友好性,在程序出现bug时一般 ...

  4. Can I Win

    In the "100 game," two players take turns adding, to a running total, any integer from 1.. ...

  5. 关于layoutSubviews

    layoutSubviews 是什么? 设定subviews的尺寸和位置,如果要精确布局,可以在子类里重写此方法.不能直接调用此方法,如果想强制layout刷新,调用setNeedsLayout来代替 ...

  6. linux下用c实现ls命令

    struct dirent中的几个成员: d_type:4表示为目录,8表示为文件 d_reclen:16表示子目录或文件,24表示非子目录 d_name:目录或文件的名称 #include < ...

  7. STM32F412应用开发笔记之五:结合W5500实现以太网通讯

    因实际使用需求我们测试一下网络通讯,在NUCLEO-F412ZG测试板上没有以太网部分,我们选择外接一个W5500的实验板.W5500支持SPI接口通讯,DC3.3V供源.而NUCLEO-F412ZG ...

  8. 记录NS_ASSUME_NONNULL_BEGIN和NS_ASSUME_NONNULL_END。

    Nonnull区域设置(Audited Regions) 如果需要每个属性或每个方法都去指定nonnull和nullable,是一件非常繁琐的事.苹果为了减轻我们的工作量,专门提供了两个宏:NS_AS ...

  9. 采用cocos2d-x lua 制作数字滚动效果样例

    require "Cocos2d"require "Cocos2dConstants"local testscene = class("testsce ...

  10. C# RSA加密解密

    1.解析密钥 /// <summary> /// 把二进制密钥解析成RSACryptoServiceProvider /// </summary> /// <param ...