Ssl

apache2無效的命令’SSLEngine'

  • January 15, 2021

當我重新啟動 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_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

我的 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>

可能您沒有載入 ssl 模組。您應該在 apache 配置文件中的某處有一個LoadModule指令。

就像是:

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

通常 apache 配置模板(在任何發行版上)都有一個名為(類似)的文件loadmodule.conf,您應該在其中找到LoadModule在伺服器啟動時載入到 apache 中的每個模組的指令。

在許多系統(Ubuntu、Suse、Debian,…)上執行以下命令來啟用 Apache 的 SSL mod:

sudo a2enmod ssl

a2enmod 手冊頁

引用自:https://unix.stackexchange.com/questions/31378