HTTPS url 有效 - HTTP 無效,因 SSL 安裝而損壞

HTTPS url 有效 - HTTP 無效,因 SSL 安裝而損壞

我最近剛在我的伺服器/網站上安裝了 SSL。完成所有步驟後,我使用以下命令檢查我的網站https://www.breakwatersurfcompany.com然而效果很好。我的 www.breakwatersurf.com 或 www.breakwatersurfcompany.com 現在顯示目錄而不是網站。我想知道這是否與我的虛擬主機檔案有關?

我正在使用 ubuntu 12.0.4 - apache2 運行 VPS LAMP。我似乎無法找出原因,有什麼想法嗎?

PS:www.breakwatersurfcompany.com 是我們的每個其他網址都重定向到的主網址,例如(www.breakwatersurf.com 重定向到 www.breakwatersurfcompany.com)。

感謝您的幫助,坦特里克

答案1

如果您的 http 目錄根目錄與 https 相同,那麼以下虛擬主機應該適合您,否則您可能需要進行適當的更改。這將覆蓋 http.conf 中預設為 80 的任何文檔根目錄。

  <VirtualHost *:80>
   #Admin email, Server Name (domain name), and any aliases
  ServerAdmin [email protected]
  ServerName  www.breakwatersurf.com
  ServerAlias breakwatersurf.com

   # Index file and Document Root (where the public files are located)
   DirectoryIndex index.html index.php
   DocumentRoot /var/www/breakwatersurf.com/
   # Log file locations
   LogLevel warn
   ErrorLog  /var/www/breakwatersurf.com/log/error_nonssl.log
   CustomLog /var/www/breakwatersurf.com/log/access_nonssl.log combined

答案2

是的,這可能與您的conf檔案有關。檢查以確保 https 和非 https 虛擬主機的 DocumentRoot 相同。如果您不確定如何找出它是什麼,您可以啟用 mod_info (請參閱頂部http://httpd.apache.org/docs/2.2/mod/mod_info.html)然後拉出資訊頁面並查看 DocumentRoot 設定的內容,然後根據需要進行更正。

答案3

檢查您的 *:80 虛擬主機配置,看來您已啟用索引。您需要添加DirectoryIndex index.html,以便生成index.html。 If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory. 參考:http://httpd.apache.org/docs/2.2/mod/core.html#options

相關內容