Apache多站点配置及启动失败解决办法
2016-01-10 08:59
706 查看
一、 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,此时命令框会提示具体的出错原因:
按上述提示直接解决。
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,此时命令框会提示具体的出错原因:
按上述提示直接解决。
相关文章推荐
- Linux下apache配置基础
- Windows下Apache配置基础
- 在Windows下配置Apache + OpenSSL 经测试可以使用
- hadoop关于java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO错误
- hadoop关于org.apache.hadoop.security.AccessControlException: Permission denied: user=Administrator, ac
- win8系统下的apache 80 端口被占用故障全解
- 关于win8系统下的80端口被占用,Apache启动失败.2,MySQL5.1启动失败,请检查相关配置
- How To Setup Apache Hadoop On CentOS
- Apache解析漏洞详解
- Apache vhost的配置
- apache 屏蔽IP段访问
- apache的源码安装详细过程全纪录
- org/apache/catalina/startup/Bootstrap : Unsupported major.minor version 51.0
- Apache+PHP安装与配置
- Linux+Apache+Mysql+Php源码安装
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- vmware安装Apache Storm集群
- Web性能压力测试工具之ApacheBench(ab)详解
- Apache设置禁止访问网站目录
- Apache Kafka:下一代分布式消息系统