身為網頁開發人員,我的電腦上本地有很多網站。我正在嘗試對其進行設置,以便可以透過 HTTPS 存取它們。
這是我的 http 配置的 vhosts 部分
<VirtualHost *:80>
ServerName test.local
ServerAlias *.local
VirtualDocumentRoot /home/jonathan/Sites/%-2/public_html
CustomLog /home/jonathan/Sites/access.log vhost_combined
ErrorLog /home/jonathan/Sites/error.log
</VirtualHost>
<VirtualHost *:443>
ServerName test.local
ServerAlias *.local
VirtualDocumentRoot /home/jonathan/Sites/%-2/public_html
CustomLog /home/jonathan/Sites/access.log vhost_combined
ErrorLog /home/jonathan/Sites/error.log
SSLEngine On
SSLCertificateFile /home/jonathan/Sites/public.cert
SSLCertificateKeyFile /home/jonathan/Sites/private.key
</VirtualHost>
我認為這很有效,因為當我去時,http://dotjs.local
我會index.html
從 得到服務/home/jonathan/Sites/dotjs/public_html/
。
如果我轉到https://dotjs.local
,我會收到警告,但如果我忽略它,我也會收到相同的文件。
我在取得工作證書時遇到問題。
我關注了(這個)[https://blog.celogeek.com/201209/209/how-to-create-a-self-signed-wildcard-certificate/]建立憑證的指南,除了我根據我的虛擬主機設定將檔案命名為 public.cert 和 private.key 。
使用以下命令建立證書時:openssl req -new -x509 -nodes -sha1 -days 3650 -key private.key > public.cert
我輸入了以下內容(我隱藏了一些個人詳細資料):
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:GB
State or Province Name (full name) [Some-State]:{My county}
Locality Name (eg, city) []:{My city}
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Blar
Organizational Unit Name (eg, section) []:Blar
Common Name (e.g. server FQDN or YOUR name) []:*.local
Email Address []:{My email address}