apache - Apache 2.4.6 中的 NameVirtualHost 指令等效?

标签 apache centos

Overview of new features in Apache HTTP Server 2.4状态:

NameVirtualHost directive:
No longer needed and is now deprecated.

有人可以解释在新版本的 Apache 中产生这种行为的虚拟主机等效语法吗?


<VirtualHost 127.0.0.3:80>
    DocumentRoot /var/www/html3
    ServerName site3.com
</VirtualHost>

<VirtualHost 127.0.0.3:80>
    DocumentRoot /var/www/html4
    ServerName site4.com
</VirtualHost>

我向大家道歉,但我已经摧毁了这个服务器,所以无法提供配置文件:(

仅供引用 我已经在网上看到一个示例,该示例将服务器名称放在 VirtualHost header 中,如下所示,这可能是问题所在,但在我有机会对其进行测试之前我无法知道这一点 future /

<VirtualHost site3.com:80>
    DocumentRoot /var/www/html3
</VirtualHost>

最佳答案

您的配置是正确的,并且自动表现得好像“NameVirtualHost 127.0.0.3:80”存在一样。如果http://site4.com似乎是默认的虚拟主机:

  • 确保您实际上是在使用“http://site4.com”进行测试
  • 确认不是浏览器缓存
  • 试试命令行客户端
  • 确保磁盘上的内容确实不同

关于apache - Apache 2.4.6 中的 NameVirtualHost 指令等效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28104496/

相关文章:

php - phpMyAdmin 上的内部服务器错误

java - 在 Apache 服务器中维护日志文件

php - 使用 file_put_contents 下载图像

apache - 在 Centos 上安装 letsencrypt 证书

c++ - 冲突的 C++ 库

apache - 协议(protocol)从 https 切换到 http 时出现 Cookie 和 Session id 问题

Java 7 update 11 在 IE8 上使用 Apache Tomcat 6.0.36 破坏了 webb 应用程序

Apache 加载 mod_ssl 但在我的虚拟主机中忽略了 <IfModule mod_ssl.c>

php - 如何减少 TTFB(到第一个字节的时间)响应?

VirtualBox CentOS 机器上的node.js,没有连接?