apache2 Invalid command ‘SSLEngine’

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

[<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="93e1fcfce7d3fffcf0f2fffbfce0e7">[email protected]</a> ~]# 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 <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5b2a0a7a8a4b6b1a0b785acb1a8a4abbdeba6aaa8">[email protected]</a>

    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 <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="97e0f2f5faf6e4e3f2e5d7fee3faf6f9efb9f4f8fa">[email protected]</a>

    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>

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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

sudo a2enmod ssl

a2enmod man page

Method 2

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.

Method 3

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

yum install mod_ssl
systemctl restart httpd

Method 4

httpd24 solution:

yum install mod24_ssl

Method 5

On Ubntu 18.04 bionic.

sudo a2enmod ssl
sudo service apache2 restart

Method 6

I received the same error while installing the SSL Certificate on my website. I have fixed it by executing the following command in the terminal.

# yum install mod_ssl
# httpd -t
# systemctl restart httpd

I am sure that the above commands will fix your error.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x