apache2 无效命令“SSLEngine”

Chr*_*ian 133 ssl apache-httpd

当我重新启动 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
Run Code Online (Sandbox Code Playgroud)

我已经使用安装了 mod_ssl yum 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
Run Code Online (Sandbox Code Playgroud)

我的sites.conf 看起来像这样

<VirtualHost *:80>
#    ServerName shop.itmanx.com
    ServerAdmin webmaster@itmanx.com

    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 webmaster@itmanx.com

    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>
Run Code Online (Sandbox Code Playgroud)

Sté*_*ane 169

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

sudo a2enmod ssl
Run Code Online (Sandbox Code Playgroud)

a2enmod 手册页

  • 这是特定于 Debian 的,但问题未标记为 Debian。 (4认同)
  • `a2enmod` 是 Debian 特有的。它管理 Debian 拆分 apache 配置方式的符号链接。你的命令相当于`ln -s /etc/apache2/mods-{available,enabled}/ssl.load; ln -s /etc/apache2/mods-{available,enabled}/ssl.conf` (4认同)
  • a2enmod 真的是 Debian 特有的吗?还是您在抱怨使用 sudo? (2认同)

and*_*coz 66

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

就像是:

LoadModule ssl_module /usr/lib64/apache2-prefork/mod_ssl.so
Run Code Online (Sandbox Code Playgroud)

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

  • `sudo a2enmod ssl` (11认同)
  • 此外,有必要安装`mod_ssl`。在 RHEL 和 CentOS 上,这是通过 `yum install mod_ssl` 完成的。 (9认同)
  • 对于 Apache 2.4,它是 yum install mod24_ssl (2认同)

Fal*_*eni 31

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

yum install mod_ssl
systemctl restart httpd
Run Code Online (Sandbox Code Playgroud)


小智 18

httpd24 解决方案:

yum install mod24_ssl
Run Code Online (Sandbox Code Playgroud)