我在配置Apache2 for SSL时遇到问题。我已经重写了几条说明和描述。
目前问题是服务器通过端口443传递页面,但它使用HTTP。
这是我的方法: 1.)证书和密钥
sudo openssl req -x509 -newkey rsa:2048 -keyout apache2.key -out apache2.pem -days 365 -nodes
证书位置是/ etc / ssl / certs,密钥是/ etc / ssl / private
2.)在/ etc / apache2 / sites-endabled中设置default-ssl.conf 该文件的注释部分是:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin localhost@localhost.de
ServerAlias localhost
DocumentRoot /var/www/html
LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache2.pem
SSLCertificateKeyFile /etc/ssl/private/apache2.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
<Directory /var/www/html>
SSLOptions +StdEnvVars
AllowOverride All
Order allow,deny
Allow from all
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
3。)httpd.conf 另外,我在/ etc / apache2 /目录中创建了一个文件httpd.conf,其中包含以下内容:
<VirtualHost _default_:443>
DocumentRoot /var/www/html
ServerName localhost
SSLEngine on
SSLCertificateKeyFile /etc/ssl/private/apache2.key
SSLCertificateFile /etc/ssl/certs/apache2.pem
</VirtualHost>
尝试使用https://localhost加载网站将导致SSL_Protocol_ERROR
尝试使用普通http://localhost加载网站将返回&#34;网站无法访问(罚款)&#34;
尝试使用http://localhost:443加载网站将返回apache2的索引页
我到底做错了什么???