When I restart httpd, I get the following error. What am I missing?

[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

I have installed mod_ssl using 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

My sites.conf looks like this

<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>
up vote 43 down vote accepted

Probably you do not load the ssl module. You should have a LoadModule directive somewhere in your apache configuration files.

Something like:

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

Usually apache configuration template has (on any distribution) a file called (something like) loadmodule.conf in which you should find a LoadModule directive for each module you load into apache at server start.

  • 2
    Also, it's necessary to install mod_ssl. On RHEL and CentOS, this is done with yum install mod_ssl. – Benedikt Köppel Apr 18 at 18:13

On many systems (Ubuntu, Suse, Debian, ...) run the following command to enable Apache's SSL mod:

sudo a2enmod ssl

a2enmod man page

  • 1
    This is Debian-specific but the question is not tagged Debian. – jordanm Feb 18 '15 at 1:32
  • 1
    is a2enmod really Debian specific? Or are you complaining about the use of sudo? – Stéphane Feb 18 '15 at 2:08
  • 4
    a2enmod is Debian specific. It manages symlinks for the way Debian splits apache configurations. Your command is the equivalent of ln -s /etc/apache2/mods-{available,enabled}/ssl.load; ln -s /etc/apache2/mods-{available,enabled}/ssl.conf – jordanm Feb 18 '15 at 3:43
  • 1
    a2enmod is also used on suse. – dr0i Feb 24 '16 at 16:01
  • worked for me on Ubuntu. thanks. – grooveplex Jun 28 '16 at 18:55

httpd24 solution:

yum install mod24_ssl
  • 1
    That presumably works for (some) RPM-based distributions only. Which one? Why does it fix the problem? – vonbrand Feb 17 '16 at 0:07
  • Worked on Amazon Linux and Centos for me. It's specifically for Apache 2.4. – dtbarne Feb 23 '16 at 16:39

On CentOS 7 installing the package "mod_ssl" and restarting the apache server worked for me:

yum install mod_ssl
systemctl restart httpd

On Ubntu 18.04 bionic.

sudo a2enmod ssl; sudo service apache2 restart

  • The second answer already recomends sudo a2enmod ssl; Maybe you should add a comment there to restart the server after the change. – Isaac Aug 15 at 8:13

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.