SSL证书的apache2服务器错误

时间:2021-01-30 11:31:01

标签: apache ubuntu ssl-certificate

所以我购买了一个 SSL 证书,需要将它添加到运行 apache2 Web 服务的 Ubuntu 中,但是由于某种原因,我的 .conf 文件一遍又一遍地向我显示相同的错误。

在运行代码 apache2ctl configtest 后,他们提到...

AH00526: Syntax error on line 58 of /etc/apache2/sites-enabled/eblossom.conf:
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.

在我的 .conf 文件中...

<VirtualHost *:80>
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # 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

        Alias /static /home/najaaz/eblossom/static
        <Directory /home/najaaz/eblossom/static>
          Require all granted
        </Directory>

        Alias /media /home/najaaz/eblossom/media
        <Directory /home/najaaz/eblossom/media>
          Require all granted
        </Directory>

        <Directory /home/najaaz/eblossom/eblossom>
          <Files wsgi.py>
            Require all granted
          </Files>
        </Directory>


        WSGIScriptAlias / /home/najaaz/eblossom/eblossom/wsgi.py
        WSGIDaemonProcess eblossom python-path=/home/najaaz/eblossom python-home=/home/najaaz/eblossom/venv
        WSGIProcessGroup eblossom


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    </VirtualHost>                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
<VirtualHost *:443>

        SSLEngine on
        SSLCertificateFile /home/najaaz/eblossom/eblossom_lk.crt
        SSLCertificateKeyFile /home/najaaz/eblossom/eblossom.lk.key
        SSLCertificateChainFile /home/najaaz/eblossom/eblossom_lk.ca-bundle

</VirtualHost>

我使用的是 Django 框架,但我不明白这个错误是在哪里以及如何导致的。 有人可以帮我解决这个问题吗? 谢谢!

1 个答案:

答案 0 :(得分:0)

运行以下命令,然后重试:

a2enmod ssl && systemctl restart apache2

基本上这个命令的作用是,它启用 mod_ssl