今天在php的集成环境laragon上添加了一个虚拟主机,域名为:whathell.com

突然想在前面加个www.

一种做法是在auto.whathell.com文件中添加如下内容:

<VirtualHost *:8090>
DocumentRoot "C:/mysoft/laragon/www/whathell/"
ServerName www.whathell.com
ServerAlias *.whathell.com
<Directory "C:/mysoft/laragon/www/whathell/">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

虽然可以实现,但又对ServerAlias不解,百度一下发现这个指令是当前虚拟主机的别名,遂

<VirtualHost *:8090>
DocumentRoot "C:/mysoft/laragon/www/whathell/"
ServerName whathell.com
ServerAlias *.whathell.com www.whathell.com
<Directory "C:/mysoft/laragon/www/whathell/">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

重启apache,发现还是启动不了,遂在网上找到一段话:

Many servers want to be accessible by more than one name. This is possible with the ServerAlias directive, placed inside the <VirtualHost> section. For example in the first <VirtualHost>block above, the ServerAlias directive indicates that the listed names are other names which people can use to see that same web site:

ServerAlias domain.tld *.domain.tld

then requests for all hosts in the domain.tld domain will be served by the www.domain.tld virtual host. The wildcard characters * and ? can be used to match names. Of course, you can't just make up names and place them in ServerName or ServerAlias. You must first have your DNS server properly configured to map those names to an IP address associated with your server.

说domain.tld不能直接访问到网站,需要DNS配置该别名的映射到当前IP,由于是在本地,遂在host文件加上www.whathell.com,然后进浏览器访问,成功了。

Apache的ServerAlias的作用的更多相关文章

  1. php和apache的关系和作用()

    出处:http://blog.csdn.net/hongweideng/article/details/41723465 php和apache的关系和作用是很多学习php的朋友非常关注的问题 首先在一 ...

  2. apache的.htaccess文件作用和相关配置

    首先.htaccess什么? .htaccess是一个纯文本文件,它里面存放着Apache服务器配置相关的指令. 当我们使用apache部署一个网站代码准备部署到网上的时候,我们手中的apache的h ...

  3. apache 中 ServerAlias让多个域名绑定到同一空间

    在apache的虚拟主机中,如果书写了.ServerAlias www.a2.com www.a3.com这样的语句,就可以给虚拟主机增加多个域名,而且这些域名都访问同一个站点. #Listen 81 ...

  4. Apache服务器安装配置

    Apache服务器安装 1.Apache服务器安装      在Linux系统下,apache服务器的安装方式比较灵活,可以使用二进制包安装,比如:rpm包.deb包.已编译好的包.也可以简单的使用y ...

  5. 对象池化技术 org.apache.commons.pool

    恰当地使用对象池化技术,可以有效地减少对象生成和初始化时的消耗,提高系统的运行效率.Jakarta Commons Pool组件提供了一整套用于实现对象池化的框架,以及若干种各具特色的对象池实现,可以 ...

  6. Apache HTTP Server 与 Apache Tomcat 的区别

    要明白他们之间的区别,我们首先需要明白HTTP协议.HTML页面.JSP.Servlet之间的区别和联系. HTTP协议是在TCP/IP协议之上的应用层协议,用以在客户端和服务器之间传递信息.一般传递 ...

  7. Linux(centOS)手动安装删除Apache+MySQL+PHP+Memcached原创无错版

    =================== 第一步:Apache安装 =================== 下载 去 http://www.apache.org 自己找最新的 国内有很多镜像点例如人人和 ...

  8. 在windows上用apache+mod_wsgi服务部署django项目

    之前一直在本地跑django项目,最近尝试在服务器上部署项目,目前已经成功部署,也花了好多时间,这里跟大家交流一下,希望对像我一样的新手有帮助. 一.配置环境: 1.Python版本3.7 2.服务器 ...

  9. Apache ZooKeeper在Kafka中的角色 - 监控和配置

    1.目标 今天,我们将看到Zookeeper在Kafka中的角色.本文包含Kafka中需要ZooKeeper的原因.我们可以说,ZooKeeper是Apache Kafka不可分割的一部分.在了解Zo ...

随机推荐

  1. outlook2010设置失败后重新设置

    1.WIN+R ,然后在弹出框中输入outlook /importprf .\.prf 2.重新设置.

  2. VS2010与Matlab2010b混合编程

    环境: 1.VS2010 2.MATLAB 2010b 3.WINDOW 7 (X64) 1.Matlab环境设置 要建立独立运行的C应用程序,系统中需要安装Matlab.Matlab编译器.C/C+ ...

  3. leetcode 381.Insert Delete GetRandom

    这道题中要求使用O(1)的方法来删除和插入元素的,那么首先需要寻找到对应的元素,这个可以使用map的O(1)的查询时间的,然后是删除对应的元素的,那么可以根据 堆排序中类似的做法把最后面的元素插入到前 ...

  4. 20155219付颖卓 《网络对抗技术》 Exp9 Web安全基础

    实验后回答问题 1.SQL注入攻击原理,如何防御 ·SQL攻击的原理很简单,就是在用户名输入框里输入SQL语句,来欺骗数据库服务器进行恶意操作 ·防御可以从以下几个方面下手: (1)在web网页设计的 ...

  5. MATLAB实现Brovey图像融合

    自定义函数: function BF=Brovey_fuse(Hyperspectral_image,High_resolution_image) x0=imread(Hyperspectral_im ...

  6. JDBCTM中Statement接口提供的execute、executeQuery和executeUpdate之间的区别

    Statement 接口提供了三种执行 SQL 语句的方法:executeQuery.executeUpdate 和 execute.使用哪一个方法由 SQL 语句所产生的内容决定. 方法execut ...

  7. Win10激活密钥key(可激活所有版本)

    Win10激活密钥key(可激活所有版本) Win10一年的免费升级服务已经到期,用户要使用Win10系统,就需要最新Win10密钥来激活Win10,一般激活Win10系统有两种方式,一个是使用Win ...

  8. 加载xib文件,如果想在初始化的时候就添加点东西就重载-(id)initWithCoder:(NSCoder *)aDecoder

    - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { self.cl ...

  9. JavaSE学习(二):进制转换—数据类型转换—Java运算符

    一.进制转换 1.1 其他进制转十进制(以十六进制为例): 十六进制范围:0-9, A-F对应数字10-15 2A7E(16)  =  14*16(0) +7*16(1) + 10*16(2)  + ...

  10. 一次奇妙的http请求之旅

    TCP/IP不是一个协议,而是一个协议族的统称.里面包括IP协议.IMCP协议.TCP协议. 这里有几个需要注意的知识点: 互联网地址:也就是IP地址,一般为网络号+子网号+主机号 域名系统:通俗的来 ...