简体   繁体   English

网站https://example.com的安全连接失败,但http://example.com的安全连接正常

[英]Secure Connection Failed for website https://example.com but works fine for http://example.com

I have apache2 running. 我正在运行apache2。 I also ran: 我还跑了:

sudo a2enmod ssl

I cannot load my website using https, but it is fine with regular http. 我无法使用https加载我的网站,但是使用常规http很好。 In Firefox: 在Firefox中:

SSL_ERROR_RX_RECORD_TOO_LONG 

In Chrome: 在Chrome中:

ERR_SSL_PROTOCOL_ERROR

netstat -lp: netstat -lp:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:ssh                   *:*                     LISTEN      168/sshd
tcp6       0      0 [::]:http               [::]:*                  LISTEN      2021/apache2
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      168/sshd
tcp6       0      0 [::]:https              [::]:*                  LISTEN      2021/apache2
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     139167163 1/init              /run/systemd/private
unix  2      [ ACC ]     SEQPACKET  LISTENING     139167175 1/init              /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     139167182 1/init              /run/systemd/journal/stdout

/etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/example-dot-com/build

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

        Redirect permanent / https://example.com/

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

/etc/apache2/sites-available/default-ssl.conf: /etc/apache2/sites-available/default-ssl.conf:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost

                DocumentRoot /var/www/html/example-dot-com/build

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

                SSLEngine on

                SSLCertificateFile /var/www/website_ssl_files/example.com.crt
                SSLCertificateKeyFile /var/www/website_ssl_files/example.com.key
                SSLCertificateChainFile /var/www/website_ssl_files/example.com-starfield.crt

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

        </VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

apachectl -S: apachectl -S:

VirtualHost configuration:
*:80                   server.example.com (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

netstat -lntp: netstat -lntp:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      168/sshd
tcp6       0      0 :::80                   :::*                    LISTEN      2446/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      168/sshd
tcp6       0      0 :::443                  :::*                    LISTEN      2446/apache2
tcp6       0      0 :::443                  :::*                    LISTEN      2446/apache2
tcp6       0      0 :::443                  :::*                    LISTEN      2446/apache2

I am running a Linux VSP using Ubuntu 16.04 Server version: Apache/2.4.18 (Ubuntu) 我正在使用Ubuntu 16.04 Server版本运行Linux VSP:Apache / 2.4.18(Ubuntu)

I followed this site: https://www.linode.com/docs/security/ssl/ssl-apache2-debian-ubuntu/#configure-apache-to-use-the-ssl-certificate 我关注了这个网站: https : //www.linode.com/docs/security/ssl/ssl-apache2-debian-ubuntu/#configure-apache-to-use-the-ssl-certificate

I created the following file, /etc/apache2/sites-available/example.com.conf : 我创建了以下文件/etc/apache2/sites-available/example.com.conf

<IfModule mod_ssl.c>
        <VirtualHost *:443>
                SSLEngine On

                SSLCertificateFile /var/www/website_ssl_files/example.com.crt
                SSLCertificateKeyFile /var/www/website_ssl_files/example.com.key
                SSLCertificateChainFile /var/www/website_ssl_files/example.com-starfield.crt

                ServerAdmin person@example.com
                ServerName myserver.example.com
                ServerAlias example.com
                        DocumentRoot /var/www/html/example-dot-com/build
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
        </VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Django如何仅将example.com重定向到https并将* .example.com重定向到http? - Django How to redirect only example.com to https and *.example.com to http? 无法将https://www.example.com重定向到https://example.com - Can't redirect https://www.example.com to https://example.com Django 为什么以及如何将 HTTP 200OK for example.com 发送到 AWS Scanner - Why and how does Django send HTTP 200OK for example.com to AWS Scanner 使www.example.com和example.com使用相同会话变量的最佳方法是什么? - Best way to make www.example.com AND example.com use the same session variables? example.com 将您重定向了太多次。 ERR_TOO_MANY_REDIRECTS - example.com redirected you too many times. ERR_TOO_MANY_REDIRECTS 如何使用SSL将example.com/directory指向另一个EC2实例? - How to point example.com/directory to another EC2 instance with SSL? 通过HTTP的ERR_CONNECTION_REFUSED,但HTTPS正常运行 - ERR_CONNECTION_REFUSED over HTTP but HTTPS works fine 无法获取 http://dl.google.com/linux/chrome/deb/dists/stable/InRelease 无法启动连接 - Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/InRelease Cannot initiate the connection 新安装的openladp - 错误:dc = example,dc = com没有这样的对象 - Newly installed openladp - error: no such object for dc=example,dc=com 我的域只适用于 https://www.domainname.com 否则 domainname.com 和 www.domainname.com 不起作用 - My domain only works with https://www.domainname.com otherwise domainname.com and www.domainname.com not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM