我试图设置一个自签名的SSL证书,所以我可以开发我的应用程序与SSL(所以我终于可以让我的网站运行SSL …)。 我已经创build了一个带有无头API(Lumen)的Angular网站,并尝试使用来自ServerFault的问题设置一个多域SSL证书:
如何为Apache2创build一个多域自签名证书?
testing命令签出,所以我试图安装与以下Apacheconfiguration的证书:
<VirtualHost *:80> ServerAdmin [email protected] ServerName api.gamersplane.local DocumentRoot /var/www/GamersPlane.api/public <Directory /var/www/GamersPlane.api/public/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog "|/usr/bin/cronolog /var/log/gamersplane/%Y/%m/%d/error.log" # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel notice CustomLog ${APACHE_LOG_DIR}/gamersplane/access.log combined SSLEngine on SSLCertificateFile /var/www/GamersPlane.api/ssl/gamersplane.local.pem SSLCertificateKeyFile /var/www/GamersPlane.api/ssl/gamersplane.local.key </VirtualHost>
不幸的是,当我打我的网站,我得到This site can't provide a secure connection 。 我尝试了谷歌search这个,但一切似乎特定于某些网站/configuration,我不知道如何debugging什么是错的。
我通过数字海洋指南设置了Apacheconfiguration,该指南也推荐了这些configuration,我不确定。 我尝试着和没有他们,没有运气:
<FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory>
我很乐意帮助您了解如何debugging/解决这些types的问题。
您需要configuration另一个Apache VirtualHost和端口443上的侦听。
请参阅: https : //httpd.apache.org/docs/2.4/ssl/ssl_howto.html
而且,如果您有证书颁发机构签署的证书,您可以免费使用https://letsencrypt.org/
我修改你的configuration有用的东西 。 应该像这样工作,但没有testing。
# only if not already listen to port 443 ! apache ssl module have to be enabled, too ! Listen 443 <VirtualHost *:443> ServerAdmin [email protected] ServerName api.gamersplane.local # ServerAlias api2.gamersplane.local DocumentRoot /var/www/GamersPlane.api/public <Directory /var/www/GamersPlane.api/public/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog "|/usr/bin/cronolog /var/log/gamersplane/%Y/%m/%d/error.log" # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel notice CustomLog ${APACHE_LOG_DIR}/gamersplane/access.log combined SSLEngine on SSLCertificateFile /var/www/GamersPlane.api/ssl/gamersplane.local.pem SSLCertificateKeyFile /var/www/GamersPlane.api/ssl/gamersplane.local.key SSLProtocol all -SSLv2 -SSLv3 SSLHonorCipherOrder on SSLCipherSuite 'HIGH:!aNULL:!eNULL:!EXP:!DES:!MD5:!PSK:!RC4:!SRP:!DSS:!CAMELLIA:!SHA' # depending on apache version also useful options: SSLCompression off SSLInsecureRenegotiation off </VirtualHost>