无法获得用于本地Web开发的SSL

时间:2019-01-07 15:10:57

标签: apache ssl

TL; DR

  • Chrome浏览器:ERR_SSL_PROTOCOL_ERROR
  • Firefox:SSL_ERROR_RX_RECORD_TOO_LONG

故事
我尝试了可以​​在互联网上找到的所有内容,但未完成任务。我想使用https设置本地服务器。到目前为止,我做了什么。

  1. 在本地服务器(PC)IP:10.0.0.2上安装了Ubuntu 18.04.1 LTS
  2. 设置Apache
  3. 设置PHP

Al在http上运行良好。

现在我要使用https,这是我设置的内容:

default-ssl.conf

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin email@domain.com
                ServerName 10.0.0.2

                DocumentRoot /var/www/

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                SSLEngine on

                SSLCertificateFile      /etc/apache2/ssl/apache-selfsigned.crt
                SSLCertificateKeyFile /etc/apache2/ssl/apache-selfsigned.key

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>


        </VirtualHost>
</IfModule>

the-ssl-domain.loc.conf

<VirtualHost *:80>
        ServerName www.ssl-domain.loc
        Redirect / https://www.ssl-domain.loc
</VirtualHost>

<VirtualHost *:443>
        ServerName www.ssl-domain.loc
        DocumentRoot /var/www/ssl-domail.loc

        <Directory /var/www/ssl-domain.loc>
                Options -Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>
        <FilesMatch \.php$>
                # Apache 2.4.10+ can proxy to unix socket
                SetHandler "proxy:unix:/var/run/php/php7.1-fpm.sock|fcgi://localhost/
        </FilesMatch>
    </VirtualHost>

当然我启用了ssl_mod并启用了站点并重新启动了Apache。

似乎所有的方法都不起作用。我继续:

  • Chrome浏览器:ERR_SSL_PROTOCOL_ERROR
  • Firefox:SSL_ERROR_RX_RECORD_TOO_LONG

我遵循了这些线程,但也没有成功

编辑
卷曲到地址:

$ curl -v https://www.domain.loc
* Rebuilt URL to: https://www.domain.loc/
*   Trying 10.0.0.2...
* TCP_NODELAY set
* Connected to www.domain.loc (10.0.0.2) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number
* stopped the pause stream!
* Closing connection 0
curl: (35) error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number

0 个答案:

没有答案