启用

时间:2019-05-07 20:26:54

标签: php linux apache ssl debian

我在Debian VM上的Apache2服务器上安装了虚拟主机,我从GoDaddy创建了SSL证书并下载了crt文件(证书和链)

在添加SSL之前,DocumentRoot指向:

  • /var/www/html/websitename/public_html/loader.php

工作正常。

但是,当我在虚拟主机中添加SSLEngineOnSSLCertificationFileSSLCertificationChainFile时,Apache2服务器拒绝启动,这是服务器日志:

May 07 20:05:05 ns507219 systemd[1]: Starting The Apache HTTP Server...
May 07 20:05:05 ns507219 apachectl[2228]: AH00112: Warning: DocumentRoot [/var/www/html/websitename/public_html/loader.php] does not exist
May 07 20:05:05 ns507219 apachectl[2228]: AH00112: Warning: DocumentRoot [/var/www/html/websitename/public_html/loader.php] does not exist
May 07 20:05:05 ns507219 apachectl[2228]: AH00112: Warning: DocumentRoot [/var/www/html/websitename/public_html/loader.php] does not exist
May 07 20:05:05 ns507219 apachectl[2228]: Action 'start' failed.

这是我的配置:

<VirtualHost websitename.ca:80>
    ServerAdmin admin@websitename.ca
    #SSLEngine on
    #SSLCertificateFile /etc/ssl/certs/mycertificate.crt
    #SSLCertificateChainFile /etc/ssl/certs/mychain.crt
    DocumentRoot /var/www/html/websitename/public_html/loader.php
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

        <FilesMatch "\.php$">
            SetHandler "proxy:fcgi://127.0.0.1:9000/"
        </FilesMatch>
</VirtualHost>
<IfModule mod_ssl.c>
    <VirtualHost websitename.ca:443>
        ServerAdmin admin@websitename.ca

        DocumentRoot /var/www/html/websitename/public_html/loader.php
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        SSLEngine on

        SSLCertificateFile /etc/ssl/certs/mycertificate.crt
        SSLCertificateChainFile /etc/ssl/certs/mychain.crt


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

如果删除if条件,则设置可以正常工作,但SSL无法正常工作。

0 个答案:

没有答案