今天在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. 微信公众号服务器配置url二次修改

    最近微信公众号配置的服务器的域名和云服务到期,就想着更换到别的域名下的服务器:修改的时候出现token验证失败: 我同样的微信签名验证代码在以前服务器上是没问题的,但是修改到新的域名地址时候,总是提醒 ...

  2. yii2下载

    我发现yii2下载贼困难,不过折腾了很久终于搞下来了. 一,设置镜像 安装composer ,   下载 composer.phar 添加中国镜像   composer config -g repo. ...

  3. 阿里云物联网套件(iot)设备间通信(M2M)在web端的实践

    之前通过nodejs连接到阿里云物联网mqtt,后又用浏览器连接,总结一下: 由于项目是SPA,使用webpack,关键代码: 同样使用mqtt.js之前先install: npm install - ...

  4. 小程序cover-view踩过的坑

    1.前段时间开发一个小程序,里边用到cover-view,发现cover-view其实很多都是不支持的,比如动画,如果你想要在cover-view上边加动画你会发现没有效果,虽然在模拟器里边可以显示动 ...

  5. Spring MVC中一般类使用service

    在Spring MVC中,Controller中使用service只需使用注解@Resource就行,但是一般类(即不使用@Controller注解的类)要用到service时,可用如下方法: 1.S ...

  6. Unity安卓打包遇到的问题。

    1, android asset packinging tool failed. "路径" package -v -f -F assets.ap_ - Assets found X ...

  7. 爬取网络图片到C盘存储的PermissionError: [Errno 13] Permission denied

    C盘根目录下不能拷进去文件,但可以新建文件夹的,“发生错误,操作被阻止,客户端没有所需的特权. 因为是系统目录,不要在里面拷贝文件,最好建立一个目录再放在里面. 硬要拷贝的话,可以使用管理员权限打开e ...

  8. Gitlab迁移之数据库报错解决

    Gitlab迁移需同版本迁移,恢复过程会出现如下提示: WARNING:  no privileges were granted for "public" 解决方法: 1. 编辑/ ...

  9. java8_api_格式化数据

    格式化数据1    Locale类    格式化日期时间    格式化数字        Locale类,主要是国际化相关        该类代表语言环境        实例化:           ...

  10. sql语句实例练习

    1.最晚入职员工查询 select * from employees where hire_date = (select max(hire_date) from employees)   2.倒数第三 ...