Apache的虚拟主机是一种同意在同一台机器上,执行超过一个站点的解决方式,同一时候也就能够邦迪二级域名到指定的文件夹。虚拟主机有两种。一种叫基于IP的(IP-based),还有一种叫基于名字的(name-based)。

虚拟主机的存在,对用户来说是透明的。

说一下基于名字的(name-based),基于IP。请自助百度。比方这http://www.cnblogs.com/see7di/archive/2011/06/15/2239756.html

打开httpd.conf

vi /etc/httpd/conf/httpd.conf

打开这行语句的凝视

NameVirtualHost *:80

在文件最后增加下面代码



 
<VirtualHost *:80>
ServerAdmin zhangningning2012@163.com
DocumentRoot /var/www/html/about
ServerName about.erdian.net
ServerAlias about.erdian.net
ServerAlias zhangningning.erdian.net
ErrorLog logs/about.com-error_log
CustomLog logs/about.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin zhangningning2012@163.com
DocumentRoot /var/www/html
ServerName erdian.net
ServerAlias *.erdian.net
ServerAlias erdian.net
ErrorLog logs/about.com-error_log
CustomLog logs/about.com-access_log common
</VirtualHost>

注意

1.VirtualHost之间是有顺序的,从第一个開始依次匹配
2.能够配置多个ServerAlias来匹配多个地址。
3.若出现403(Forbidden),将AllOverride None改为AllOverride All

p=222">http://www.erdian.net/?p=222

版权声明:本文博客原创文章,博客,未经同意,不得转载。

Apache 配置两个域名匹配的文件夹和配置多个Web站点的更多相关文章

  1. Win7中的IIS配置asp时出现“出现403 文件夹禁止訪问错误”!

    Win7中的IIS配置asp时出现"出现403 文件夹禁止訪问错误"! 在[默认文档]中设一下启动文件即可了.

  2. asp.net上传文件夹权限配置以及权限配置的分析

    切记:一定要禁止给公共上传文件夹的权限设置为everyone,且为完全控制!除非你这个文件夹属于内部操作的,那这样做是允许,其余情况一律禁止! 基本的文件上传文件夹权限配置: 1.在需要配置上传的文件 ...

  3. apache主机(网站)配置,port监听,文件夹訪问权限及分布式权限

    前言 一个网站的两个核心信息为: 主机名称(server名/网站名):ServerName server名 网站位置(网站文件夹路径):DocumentRoot "实际物理路径" ...

  4. Nginx 怎么给一台服务器,配置两个域名?详细的解说+截图教程

    一.        环境.条件准备 一台云服务器(我的是腾讯的centos7) 至少两个域名.(我的是simuhunluo.xyz和simuhunluo.top.这两个域名之间没有任何关系,我是在阿里 ...

  5. nginx 配置两个域名

    1.首先第一步安装: 参考:https://www.cnblogs.com/wyd168/p/6636529.html 启动: /usr/local/nginx/sbin/nginx -c /usr/ ...

  6. Tomcat配置域名和虚拟文件夹

    说明: 我在本机中添加域名模拟,假设是主机直接配置也能够使用.我用的tomcat是apache-tomcat-7.0.42 本地添加域名 本文介绍怎样通过改动tomcat的配置.实现通过IP地址或者域 ...

  7. win7+Apache 设置域名指向本地文件夹

    实现:浏览器地址栏输入 www.bnzoo.com 访问 D:/www 系统:win7旗舰版+Apache 步骤: 1.打开文件 C:\Windows\System32\drivers\etc\hos ...

  8. (配置)CKEditor+CKFinder+php上传配置,根据年月命名创建文件夹来存放

    CKEditor+CKFinder+php上传配置 新版本的CKEditor只提供了基本的文本编辑功能,上传模块由另一个组件CKFinder.这里主要记录CKFinder上传的一些参数配置,能够成功上 ...

  9. Apache OFBIZ高速上手(三)--文件夹&amp;&amp;配置文件介绍

    1.OFBiz简单介绍,什么是OFBiz           OFBiz is an Apache Software Foundation top level project.           A ...

随机推荐

  1. 【31.72%】【codeforces 604B】More Cowbell

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  2. window下利用navicat访问Linux下的mariadb数据库

    1.再Linux上成功安装mariadb数据库后,不管是在dos(敲命令mysql -h192.168.136.8 -uroot -p)下或者是navicat(创建连接)下连接mariadb数据库,会 ...

  3. jquery-10 js加载的时机如何选择

    jquery-10 js加载的时机如何选择 一.总结 一句话总结:主要应用widow的ready()方法和load()方法. 1.内部文件中DOM加载完毕执行js如何书写? 把js标签放在body之后 ...

  4. 离线下载chrome

    https://gallery.technet.microsoft.com/Google-Chrome-version-f0619a1f

  5. [CSS] Showing horizontal scrollbar always for the table

    table { display: block; overflow: scroll; width: 200px; height:95vh; }

  6. [Compose] 16. Apply multiple functors as arguments to a function (Applicatives)

    We find a couple of DOM nodes that may or may not exist and run a calculation on the page height usi ...

  7. [RxJS] Add debug method to Observable in TypeScript

    Observable.prototype.debug = function(message: any) { return this.do( (next) => { if(!environment ...

  8. Windows 计算程序运行时间(高精度计时)

    首先,认识一下clock()和GetTickCount(): 一.clock()clock()是C/C++中的计时函数,而与其相关的数据类型是clock_t.在MSDN中,查得对clock函数定义如下 ...

  9. Graphics-Processing Architecture Based on Approximate Rendering

    BACKGROUND The present invention generally relates to the processing of graphics data, and particula ...

  10. XMPP之ios即时通讯客户端开发-mac上搭建openfire服务器(二)

    come from:http://www.cnblogs.com/xiaodao/archive/2013/04/05/3000554.html 一.下载并安装openfire 1.到http://w ...