Apache2 与 LetEncrypt

Apache2 与 LetEncrypt

当我尝试获取 LetEncrypt SSL 证书以与我的 Apache2 服务器配合使用时,我遇到了奇怪的重定向。8080 和 443 端口都已打开并在 Apache2 服务器上监听。我运行了 letsencrypt 并选择了仅用于 443 访问的安全选项。但是现在当我尝试登录我的服务器时https://本地主机,我被重定向到https://本地主机:8080出现以下错误:

SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG

Apache 似乎正在尝试在 443 上提供常规流量,但我不确定原因。我的可用站点如下:

/etc/apache2/sites-available$ ll
total 32
drwxr-xr-x 2 root root 4096 Mar 28 12:29 ./
drwxr-xr-x 8 root root 4096 Mar 28 12:33 ../
-rw-r--r-- 1 root root 1465 Mar 28 12:10 000-default.conf
-rw-r--r-- 1 root root 1736 Mar 28 12:20 000-default-le-ssl.conf
-rw-r--r-- 1 root root  232 Mar 28 12:27 backupnext.conf
-rw-r--r-- 1 root root 6338 Apr  5  2016 default-ssl.conf
-rw-r--r-- 1 root root  409 Mar 28 12:29 nextcloud.conf

nextcloud.conf

<VirtualHost *:8080>
 DocumentRoot "/webroot/nextcloud"
 ServerName PRIVATE

 ErrorLog /var/log/apache2/error.log
 CustomLog /var/log/apache2/access.log combined

<Directory /webroot/nextcloud/>
 Options +FollowSymlinks
 AllowOverride All

 <IfModule mod_dav.c>
 Dav off
 </IfModule>

 SetEnv HOME /webroot/nextcloud
 SetEnv HTTP_HOME /webroot/nextcloud
 Satisfy Any

</Directory>

</VirtualHost>

和默认的 letsencrypt 配置:

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com
        SSLEngine On
    ServerAdmin webmaster@localhost
    DocumentRoot /webroot

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

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

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /etc/letsencrypt/live/radonc.bounceme.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/radonc.bounceme.net/privkey.pem
 <IfModule mod_headers.c>
     Header always set Strict-Transport-Security "max-age=15768000; preload"
 </IfModule>
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName PRIVATE
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>

两者都软链接到 site-enabled 文件夹,并且 ssl 和 default-ssl 模块已激活。

对于这个问题您有什么想法吗?

马蒂

答案1

没关系,明白了。

我删除了 site-enabled 中 nextcloud.conf 的链接,然后将域添加到 nextclouds 受信任域配置中。完成此操作后,所有内容都会通过 443 发送,一切正常。

相关内容