Apache | 使用自签名 SSL 证书重定向不起作用

Apache | 使用自签名 SSL 证书重定向不起作用

操作系统:Ubuntu 16.04

我正在尝试为 apache 启用自签名证书。我已经使用以下命令创建了证书:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt

我的 default-ssl.conf 是:

        <VirtualHost _default_:443>
                ServerAdmin [email protected]
                ServerName pvapp.test-campus.de
                DocumentRoot /var/www/client/pvapp-client/dist

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

                SSLEngine on

                SSLCertificateFile    /etc/ssl/certs/apache-selfsigned.crt
                SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

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

                 BrowserMatch "MSIE [2-6]" \
                               nokeepalive ssl-unclean-shutdown \
                               downgrade-1.0 force-response-1.0

        </VirtualHost>

vhost 的 testServer.conf 是:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/client/pvapp-client/dist
    Redirect permanent / https://pvapp.test-campus.de

    <Directory /var/www/client/pvapp-client/dist>
        AllowOverride All
        Order allow,deny
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ app.php [QSA,L]
        </IfModule>
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/test.com-error.log
    CustomLog ${APACHE_LOG_DIR}/test.com-access.log combined
</VirtualHost>

我正在重定向到 https://.... 页面,但无法访问该页面。没有该重定向,它在标准 IP 上工作,但它只是 http。conf 文件已启用 a2ensite 并检查防火墙。

当在 chrome 中调用该网站时,它响应“无法找到服务器 IP”。

相关内容