apache - 无法提供目录/var/www/html/: No matching DirectoryIndex

标签 apache http ssl

我确信这个问题已经被提出并得到解答,但我没有找到解决方案。我有一个虚拟主机,刚刚添加了 SSL,但它没有按预期工作。非SSL版本工作正常。以下是我在 httpd.conf 中得到的内容:

<VirtualHost mysite.com:443>
  ServerAdmin <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cca9a1ada5a08ca1b5a9a1ada5a0e2afa3a1" rel="noreferrer noopener nofollow">[email protected]</a>
  ServerName  mysite.com
  ServerAlias www.mysite.com
  DocumentRoot /var/www/html/www.mysite.com

  <Directory /var/www/html/www.mysite.com>
      DirectoryIndex index.html index.htm index.php
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
              Require all granted
  </Directory>

  SSLEngine on
  SSLCertificateFile /etc/pki/tls/certs/my.crt
  SSLCertificateKeyFile /etc/pki/tls/private/my.key
</VirtualHost>

我收到的错误是:

[Thu Jan 11 12:29:58.984354 2018] [autoindex:error] [pid 19998] [client 
IP:38470] AH01276: Cannot serve directory /var/www/html/: No matching 
DirectoryIndex (index.html,index.php) found, and server-generated directory 
index forbidden by Options directive

显然,我已将目录设置为/var/www/html/www.mysite.com,但它尝试直接从/var/www/html 提供内容。

我确信这很简单,但我的大脑已经因整天在这个网站上工作而变得糊涂,所以我可能只是看不到我面前的东西。

谢谢!

最佳答案

已修复。正如我所假设的,很简单。变化:

<VirtualHost mysite.com:443>

致:

<VirtualHost *:443>

关于apache - 无法提供目录/var/www/html/: No matching DirectoryIndex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48207386/

相关文章:

spring-boot - 将客户端证书与改造 (okhttp) 一起使用时出现 bad_certificate 错误,但与 curl 一起使用时效果很好

java.lang.IllegalAccessError : tried to access method org. org.apache.poi.openxml4j.opc.ZipPackage 类中的 apache.poi.util.POILogger.log

apache - apache tomcat 7 角色名中的无效字符

暂时不可用页面的 HTTP 状态码

http - 如何定义 HTTP 对象?

php - SSL 加密问题

php - 如何在cPanel Hosting中像Wamp一样设置对 "Allow from all "的权限

Ubuntu 上的 PHP 从命令行加载 MSSQL 扩展,但在通过 Apache 运行时不加载

http请求命令行工具

java - 为 Tomcat 7 配置 SSL 导致 ERR_SSL_VERSION_OR_CIPHER_MISMATCH 错误