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 ...
随机推荐
- spring cloud_1_mm_eureka
有的人不知道导什么包 什么版本好 可能教程版本十几根本不能用 这里建议直接用idea生成 避免麻烦 eureka-sever application.yml #注册中心端口 server: port: ...
- js bind绑定事件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Linux 安装aria2
Ubuntu/Linux Mint/Debian sudo apt-get install aria2 CentOS/Fedora sudo yum install aria2 Manjaro/Arc ...
- vue使用vue-video-player在直播中的应用
文档地址:https://github.com/savokiss/vue-videojs-demo live demo地址:https://github.com/savokiss/vue-videoj ...
- PCP
1, What is PCP?Prior Comparable Period2, Why needs PCP?This is to compare the value with history val ...
- python开发流程及项目目录规范
# 项目开发流程 1.调研 2.需求分析 ---产品经理 3.任务分配 ---项目经理 4.写项目demo ---项目经理.架构师.程序猿 5.架构分析 ---项目经理.架构师 6.编 ...
- vue 判断数组是否为空
为空:array == undefined || array.length <= 0 (顺序不能调换) 不为空: array !==undefined && array.leng ...
- PAT乙级考前总结(四)
散列相关问题 1029 旧键盘 (20 分) 旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现.现在给出应该输入的一段文字.以及实际被输入的文字,请你列出肯定坏掉的那些键. 输入格式: ...
- asdasf
bigFile = open('big.txt',mode='r',encoding='utf-8') bigText = bigFile.read() bigFile.close() print(b ...
- C#服务端Web Api
本教程已经录制视频,欢迎大家观看我在CSDN学院录制的课程:http://edu.csdn.net/lecturer/944