简体   繁体   English

apache虚拟主机中的服务器名称中是否包含www

[英]Is www included in the server name in apache virtual host

I'm looking to set up VirtualHosts on my apache server and was looking for documentation that would tell me if these 2 entries are identical 我正在寻找在我的apache服务器上设置VirtualHosts,并正在寻找可以告诉我这两个条目是否相同的文档

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example1.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName example1.com
</VirtualHost>

Notice the lack of www. 请注意缺少www. in the second one. 在第二个。

Thanks 谢谢

This is from the Apache docs (http://httpd.apache.org/docs/2.0/mod/core.html#servername): 这来自Apache文档(http://httpd.apache.org/docs/2.0/mod/core.html#servername):

The ServerName directive sets the hostname and port that the server uses to identify itself. ServerName指令设置服务器用来标识自身的主机名和端口。 This is used when creating redirection URLs. 在创建重定向URL时使用。 For example, if the name of the machine hosting the web server is simple.example.com, but the machine also has the DNS alias www.example.com and you wish the web server to be so identified, the following directive should be used: 例如,如果承载Web服务器的计算机的名称为simple.example.com,但该计算机还具有DNS别名www.example.com,并且您希望如此标识Web服务器,则应使用以下指令:

ServerName www.example.com:80 ServerName www.example.com:80

So I guess they are not identical. 所以我想它们并不相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM