1
主要想法是我想將我的真實網頁升級到https,但它在生產中,我想在本地服務器中進行此升級以確保其正常工作,並在此之後移動所有更改到生產。所以我試圖創建本地https網站,但我的瀏覽器谷歌瀏覽器給我錯誤。我寫這個命令在我的Linux終端,用於創建自簽名證書忽略apache上的自簽名證書
sudo openssl req -new -sha256 -out new.ssl.csr
sudo openssl rsa -in privkey.pem -out new.cert.key
sudo openssl x509 -in new.ssl.csr -out new.cert.cert -req -signkey new.cert.key -days 256
sudo cp new.cert.cert /etc/ssl/certs/server.crt
sudo cp new.cert.key /etc/ssl/private/server.key
而且我改變了我的主機配置文件中像這樣
VirtualHost *:80
ServerName localsite
DocumentRoot /var/www/localsite
ErrorLog ${APACHE_LOG_DIR}/localsite_error.log
CustomLog ${APACHE_LOG_DIR}/localsite_access.log combined
VirtualHost
VirtualHost *:443
ServerAdmin [email protected]
ServerName localsite.local
DocumentRoot /var/www/localsite
ErrorLog ${APACHE_LOG_DIR}/localsite_error.log
CustomLog ${APACHE_LOG_DIR}/localsite_access.log combined
SSLEngine on
SSLOptions +StrictRequire
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
VirtualHost
sudo service apache2 restart
和之後我出口證書從我的文件並導入它到谷歌瀏覽器,仍然有ERR_CERT_AUTHORITY_INVALID
錯誤。我做錯了什麼?
沒有必要爲(本地)開發擁有授權證書。 –