![](/img/trans.png)
[英]Trying to set up SSL/TLS certificate on Debian Apache AWS Lightsail instance by following tutorial, but still not working
[英]Debian 8 - SSL Certificate is not working
我最近將網站從舊的Web服務器123-reg.co.uk移到了由Linode托管的新的Linode Web服務器。
我在Debian 8.9上運行Apache。
123-reg為我提供了網站的SSL證書,當我將網站移至新服務器時,該證書當然已停用。 因此,我設置為手動在新服務器上重新激活證書。
我能夠從123-reg中獲取必要的SSL文件(CA Bundle,密鑰和證書),並按照以下教程使用Linode的指示在其服務器上設置SSL證書:
這是站點的配置文件:
<VirtualHost *:80>
# All of the files here exist on the server
SSLEngine On
SSLCertificateFile /etc/ssl/certs/zetec-it.com.crt
SSLCertificateKeyFile /etc/ssl/private/zetec-it.com.key
SSLCACertificateFile /etc/ssl/certs/ca-certificates.crt
ServerAdmin webmaster@zetec-it.com
ServerName zetec-it.com
ServerAlias www.zetec-it.com
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/zetec-it.com/public_html
LogLevel warn
ErrorLog /var/www/html/zetec-it.com/log/error.log
CustomLog /var/www/html/zetec-it.com/log/access.log combined
</VirtualHost>
該設置似乎合法,但是當我嘗試通過https
訪問該網站時,瀏覽器指出連接不安全。
我是服務器管理員的新手。 有沒有人有任何建議或潛在的解決方案?
您需要一個正在偵聽端口443的VirtualHost
才能使用有效的HTTPS。 您已將VirtualHost
配置為在SSLEngine On
上偵聽端口80。
為了使https工作,您只需將<VirtualHost *:80>
更改為<VirtualHost *:443>
。 完成此操作后,您將沒有處理HTTP連接的配置(不會有任何VirtualHost
等待ServerName zetec-it.com
連接)。
通常,有幾種方法可以服務於請求相同主機名的http連接:
您可以使用以下方式將它們重定向到https(使用mod_rewrite
來重定向到同一路徑):
\n <VirtualHost *:80>\n 服務器名稱zetec-it.com\n ServerAlias www.zetec-it.com\n\n 在RewriteEngine上\n RewriteRule ^ https://zetec-it.com% {REQUEST_URI} [END,NE,R =永久]\n </虛擬主機>\n
您也通過http傳遞相同的內容
\n <VirtualHost *:80>\n #此處所有文件都存在於服務器上\n ServerAdmin webmaster@zetec-it.com\n 服務器名稱zetec-it.com\n ServerAlias www.zetec-it.com\n\n DirectoryIndex index.html index.php\n DocumentRoot /var/www/html/zetec-it.com/public_html\n LogLevel警告\n 錯誤日志/var/www/html/zetec-it.com/log/error.log\n CustomLog /var/www/html/zetec-it.com/log/access.log組合\n </虛擬主機>\n
無論哪種方式,您都需要兩個配置文件,一個是https(這基本上是您的示例,請記住用443替換80),另一個是http,我為您提供了2個示例。 您可以將它們放入單獨的文件中,請記住在這種情況下將其激活。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.