簡體   English   中英

從1&1到AWS EC2實例的SSL證書不起作用

[英]SSL Certificate from 1&1 to an AWS EC2 instance not working

我有一個使用ubuntu在AWS EC2實例上運行的php Web應用程序。 但是,它的域名來自1&1,並且指向AWS EC2公共IP。 我在同一域名上有來自1&1的SSL證書。

在瀏覽器中使用http運行網頁時,一切正常。 但是,一旦我使用https運行它,就會有恆定的負載並且頁面永遠不會呈現。

我想這個問題是由我的apache配置引起的,但是我不知道需要更改什么才能使https工作正常。

這是我的mydomain.com.conf:

<VirtualHost *:80>
        ServerName www.mydomain.com
        ServerAlias mydomain.com
        DocumentRoot "/var/www/html/mydomain/"

        ErrorLog ${APACHE_LOG_DIR}/error_mydomain.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

通過在互聯網上查看,我發現必須將ssl密鑰添加到conf文件中,但是由於我使用的是1&1的ssl證書,因此我沒有任何密鑰。

有誰知道更多嗎? 謝謝

好的,所以我知道不會遇到同樣的問題的人很多,但是我們永遠不知道...

確實沒有/ ssl / cert文件是不可能做到這一點的。

不幸的是,1&1在最終包裝中提供的1 SSL證書僅適用於1&1托管的網站。 我打電話給他們,他們不想給我證書文件,因為我的網頁托管在AWS上。

因此,沒有其他選擇可以獲取其他SSL證書。 我可能會為此使用letencrypt。

您必須已經從CA供應商處獲得了證書和證書捆綁包,並且我希望您在為捆綁包創建CSR時保持私鑰不變,您的虛擬主機應如下所示:

    <VirtualHost *:80>
    ServerName <mywebsite>
    ServerAlias www.<mywebsite>
        DocumentRoot /var/www/html/<mywebsitedocroot>
    DirectoryIndex index.php index.html

        <Directory /var/www/html/<mywebsitedocroot>>
                #Options Indexes FollowSymLinks MultiViews
        Options -Indexes
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/<mywebsitedocroot>
    DirectoryIndex index.php index.html
    ServerName <mywebsite>
    ServerAlias www.<mywebsite>
    SSLEngine On
    #SSLCertificateFile /etc/ssl/certs/<mycert>.crt
    #SSLCertificateKeyFile /etc/ssl/certs/<mycert>.key
    SSLCertificateFile /etc/ssl/certs/<mycert>_com.crt
    SSLCertificateKeyFile /etc/ssl/certs/<mycert>_com.key
    SSLCertificateChainFile /etc/ssl/certs/<mycert>_com.ca-bundle
    <Directory /var/www/html/<mywebsitedocroot>>
        #Options Indexes FollowSymLinks MultiViews
                Options -Indexes
        AllowOverride All
                Order allow,deny
                Allow from all
                Require all granted
        </Directory>
</VirtualHost> 

必須理解的是,HTTPS偵聽端口443,而不是80(用於HTTP),最重要的部分(考慮您的情況)是:

SSLCertificateFile /etc/ssl/certs/<mycert>_com.crt
SSLCertificateKeyFile /etc/ssl/certs/<mycert>_com.key
SSLCertificateChainFile /etc/ssl/certs/<mycert>_com.ca-bundle

您可以忽略我設置的所有選項,也可以根據需要進行設置。 我只是從我的網站conf中獲取信息。 希望這可以幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM