apache2 无效命令“SSLEngine”

apache2 无效命令“SSLEngine”

当我重新启动 httpd 时,出现以下错误。我缺少什么?

[root@localhost ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: Syntax error on line 22 of /etc/httpd/conf.d/sites.conf:
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration

我已经使用安装了 mod_sslyum install mod_ssl openssh

Package 1:mod_ssl-2.2.15-15.el6.centos.x86_64 already installed and latest version
Package openssh-5.3p1-70.el6_2.2.x86_64 already installed and latest version

我的sites.conf 看起来像这样

<VirtualHost *:80>
#    ServerName shop.itmanx.com
    ServerAdmin [email protected]

    DocumentRoot /var/www/html/magento
    <Directory /var/www/html>
        Options -Indexes
        AllowOverride All
    </Directory>

    ErrorLog logs/shop-error.log
    CustomLog logs/shop-access.log
</VirtualHost>

<VirtualHost *:443>
    ServerName secure.itmanx.com
    ServerAdmin [email protected]

    SSLEngine on
    SSLCertificateFile /etc/httpd/ssl/secure.itmanx.com/server.crt
    SSLCertificateKeyFile /etc/httpd/ssl/secure.itmanx.com/server.key
    SSLCertificateChainFile /etc/httpd/ssl/secure.itmanx.com/chain.crt

    DocumentRoot /var/www/html/magento
    <Directory /var/www/html>
        Options -Indexes
        AllowOverride All
    </Directory>

    ErrorLog logs/shop-ssl-error.log
    CustomLog logs/shop-ssl-access.log    
</VirtualHost>

答案1

在许多系统(Ubuntu、Suse、Debian...)上运行以下命令来启用 Apache 的 SSL mod:

sudo a2enmod ssl

a2enmod 手册页

答案2

可能您没有加载 ssl 模块。你应该有一个加载模块指令位于 apache 配置文件中的某处。

就像是:

LoadModule ssl_module /usr/lib64/apache2-prefork/mod_ssl.so

通常 apache 配置模板(在任何发行版上)都有一个名为(类似于)的文件,loadmodule.conf您应该在其中找到LoadModule在服务器启动时加载到 apache 的每个模块的指令。

答案3

在 CentOS 7 上安装软件包“mod_ssl”并重新启动 apache 服务器对我有用:

yum install mod_ssl
systemctl restart httpd

答案4

在 Ubntu 18.04 仿生上。

sudo a2enmod ssl
sudo service apache2 restart

相关内容