Apache服务器配置多个虚拟主机
2015-08-03 21:58
513 查看
引子
在写这片博客的时候,我几乎是热泪盈眶的,因为在我配置虚拟主机的过程中,遇到了一道坎,用了四五个小时才搞定(请原谅我只是个菜鸟 \(^o^)/),特记录下来,以便自己以后遇到类似的问题做查证,也为大家做个参考。首先说明:本文中所用的Apache版本为:5.6.11
问题描述
在配置多个虚拟主机的过程中,需要将:#Virtual hosts
#Include conf/extra/httpd-vhosts.conf
中的Include前的#注销,即删除#,表示启用httpd-vhosts.conf配置。我的问题就是,在注销掉#之后,Apache服务器就无法启动了。后面经过各种查找资料。终于找到了解决之道。
我的解决办法
这种问题,如果之前Apache服务器能够正常启动,那么一般都是httpd-vhosts.conf配置文件有错误导致的。需要正确配置httpd-vhosts.conf文件。下面贴出我的配置文件,其中有些项是可有可无的(注意:其他地方不要改,只要在文件最后加上加上即可!!!):[code]<VirtualHost *:80> #这个表示管理员的邮箱 ServerAdmin admin@admin.com #这个表示虚拟主机的文件根目录 DocumentRoot "N:Apache/htdocs/my" #这个表示打开虚拟主机后,显示的页面 DirectoryIndex Welcome.html index.html index.htm index.php #这个表示服务器的名称 ServerName www.yongf.com #这个可以省略,表示服务器的别名 ServerAlias yongf.com www.yongf.com.cn #这个表示错误日志的存放地址 ErrorLog "logs/yongf.com-error.log" #这个表示日志 CustomLog "logs/yongf.com-access.log" common </VirtualHost>
相关文章推荐
- 学习 Apache 的一些心得体会[转]
- Apache虚拟主机配置,实现多域名访问本地项目PHP空间,以及配置403Forbidden等错误的解决办法
- PHP + Apache 配置
- 分布式日志收集系统Apache Flume的设计详细介绍
- Apache的prefork模式和worker模式
- fedora下安装apache过程实录
- Apache优化:修改最大并发连接数
- Apache -- 压力测试工具ab.exe
- Apache Mina - 简单的服务端和客户端的搭建
- apache 配置
- Apache Commons 工具包
- Apache的RewriteRewriteRule ^/t_(.*).html$ /test.php?id=$1 学习
- 阿里云Ubuntu系统+Apache2+PHP搭建gitblog
- Apache 多网站配置
- AMP(Apache+Mysql+PHP)的安装与配置
- ubutun 下webalizer 分析Apache日志
- ubutun 下webalizer 分析Apache日志
- Apache配置必配基础
- apache配置防盗链
- Ubuntu apache