Apache的ServerAlias的作用
今天在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的作用的更多相关文章
- php和apache的关系和作用()
出处:http://blog.csdn.net/hongweideng/article/details/41723465 php和apache的关系和作用是很多学习php的朋友非常关注的问题 首先在一 ...
- apache的.htaccess文件作用和相关配置
首先.htaccess什么? .htaccess是一个纯文本文件,它里面存放着Apache服务器配置相关的指令. 当我们使用apache部署一个网站代码准备部署到网上的时候,我们手中的apache的h ...
- apache 中 ServerAlias让多个域名绑定到同一空间
在apache的虚拟主机中,如果书写了.ServerAlias www.a2.com www.a3.com这样的语句,就可以给虚拟主机增加多个域名,而且这些域名都访问同一个站点. #Listen 81 ...
- Apache服务器安装配置
Apache服务器安装 1.Apache服务器安装 在Linux系统下,apache服务器的安装方式比较灵活,可以使用二进制包安装,比如:rpm包.deb包.已编译好的包.也可以简单的使用y ...
- 对象池化技术 org.apache.commons.pool
恰当地使用对象池化技术,可以有效地减少对象生成和初始化时的消耗,提高系统的运行效率.Jakarta Commons Pool组件提供了一整套用于实现对象池化的框架,以及若干种各具特色的对象池实现,可以 ...
- Apache HTTP Server 与 Apache Tomcat 的区别
要明白他们之间的区别,我们首先需要明白HTTP协议.HTML页面.JSP.Servlet之间的区别和联系. HTTP协议是在TCP/IP协议之上的应用层协议,用以在客户端和服务器之间传递信息.一般传递 ...
- Linux(centOS)手动安装删除Apache+MySQL+PHP+Memcached原创无错版
=================== 第一步:Apache安装 =================== 下载 去 http://www.apache.org 自己找最新的 国内有很多镜像点例如人人和 ...
- 在windows上用apache+mod_wsgi服务部署django项目
之前一直在本地跑django项目,最近尝试在服务器上部署项目,目前已经成功部署,也花了好多时间,这里跟大家交流一下,希望对像我一样的新手有帮助. 一.配置环境: 1.Python版本3.7 2.服务器 ...
- Apache ZooKeeper在Kafka中的角色 - 监控和配置
1.目标 今天,我们将看到Zookeeper在Kafka中的角色.本文包含Kafka中需要ZooKeeper的原因.我们可以说,ZooKeeper是Apache Kafka不可分割的一部分.在了解Zo ...
随机推荐
- QWaitConditioin的思考1
16:50:392017-03-31 本文章为原创,如若引用请指明出处,否则追责. 以 生产.消费者的例子说明 #include <QtCore/QCoreApplication>#inc ...
- URL tomcat中文乱码
<Connector port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8" conn ...
- java高级进阶
- AI之旅(5):正则化与牛顿方法
前置知识 导数,矩阵的逆 知识地图 正则化是通过为参数支付代价的方式,降低系统复杂度的方法.牛顿方法是一种适用于逻辑回归的求解方法,相比梯度上升法具有迭代次数少,消耗资源多的特点. 过拟合与欠 ...
- 使用[].forEach.call()方法的写拖拽排序。
---恢复内容开始--- }); });}要引用两个插件: <script src="./jquery.1.12.4.min.js"></script> & ...
- zabbix监控Apache
zabbix 3.4.4监控apache 一.Apache开启状态页面 [root@oneapm-test scripts]# httpd -v Server version: Apache/2. ...
- 第3章 Data语意学
在C++中经常会遇到一个类的大小问题,关于一个类的大小一般受到三个方面的影响. 语言本身所造成的额外负担,如在虚拟继承中会遇到如派生类中会包含一个指针指向base class subobjec,这样会 ...
- python实现linux下文件遍历
import os def getAllFile(*names): if len(names) == 0: return "" else: allList = [] for nam ...
- python实现redis分布式锁
https://www.cnblogs.com/wangwei916797941/p/10030805.html
- 【转】linux scp远程拷贝文件及文件夹
转自:http://www.jb51.net/LINUXjishu/73131.html 1.拷贝本机/home/administrator/test整个目录至远程主机192.168.1.100的/r ...