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>
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>
When configure apache2 virtual hosts for ssl/https connection, after adding configuration and enable the configuration with this command » a2ensite pm.university.com.conf » i got this error «Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration». I will answer my own question.
asked Jun 2, 2017 at 19:15
It turned out I did enabled ssl module but i had to do it again and it works, here is the command:
sudo a2enmod ssl
Now restart apache like so service apache2 restart
no more error, FIXED!
answered Jun 2, 2017 at 19:15
DungDung
19.2k9 gold badges59 silver badges54 bronze badges
2
Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration
Simply:
This error likely happens on apache if your «virtual host» is trying to use SSL but you did not install SSL module on your apache.
Case 1: For Centos (linux distro), run:
yum install mod_ssl openssh
Case 2: For Ubuntu or Debian (linux distros), run:
sudo a2enmod ssl
And it should install and configure everything (a new file *-ssl.conf should appear in your conf.modules.d folder)
answered May 24, 2020 at 1:32
ofundefinedofundefined
2,7323 gold badges19 silver badges35 bronze badges
sudo a2enmod ssl
and restart the apache service that will do the trick
answered Oct 15, 2017 at 5:10
sudo yum install mod_ssl
sudo a2enmod ssl
sudo apachectl restart
Jeremy Caney
7,12471 gold badges48 silver badges77 bronze badges
answered Oct 27, 2020 at 20:02
PHIRUNPHIRUN
511 silver badge1 bronze badge
- When you edit the site configuration file, you have to test the configuration before enabling the site just to ensure its Syntax is correct. Use the command below to test the configuration.
apache2ctl configtest
or
sudo apache2ctl configtest
So if the syntax is correct you get a response similar to the one below
- If you get the SSLEngine: Invalid command error then run the following command and go back to step one, solve all Syntax errors until it says Syntax OK.
sudo a2enmod ssl
- Restart apache using the following command
sudo apachectl restart
Hopefully that solves the error.
answered Jan 25, 2021 at 14:46
TinasheTinashe
1,06212 silver badges20 bronze badges
Try following Solution:
- Open the file httpd.conf at «your apache folder»/conf
- Find the following line using CTRL+f in your text editor: #LoadModule ssl_module modules/mod_ssl.so
- Remove the #(uncomment the line)
- Save and restart your apache
answered Aug 7, 2022 at 5:42
srihithasrihitha
3712 silver badges14 bronze badges
My SSL virtual host is as simple as that:
LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost *:443>
DocumentRoot "/srv/www/test"
ServerName <my_website_domain>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>
When I try to restart apache with apache2ctl configtest && systemctl restart apache2
I get:
Syntax OK
Job for apache2.service failed because the control process exited with error code. See «systemctl status apache2.service» and «journalctl -xe» for details.
But when I turn off SSLEngine with SSLEngine off
apache starts normally and ok.
When I run systemctl status apache2
after starting with SSLEngine on
, I get:
Syntax OK
● apache2.service - The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-08-14 18:06:55 CEST; 1min 9s ago
Process: 22352 ExecStop=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful-stop (code=exited, status=0/SUCCESS)
Process: 19851 ExecReload=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful (code=exited, status=0/SUCCESS)
Process: 22346 ExecStart=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k start (code=exited, status=1/FAILURE)
Main PID: 22346 (code=exited, status=1/FAILURE)
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351148 2020] [so:warn] [pid 22352] AH01574: module authn_core_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351163 2020] [so:warn] [pid 22352] AH01574: module authz_core_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351170 2020] [so:warn] [pid 22352] AH01574: module php5_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351179 2020] [so:warn] [pid 22352] AH01574: module ssl_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.352998 2020] [so:warn] [pid 22352] AH01574: module ssl_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.356261 2020] [core:warn] [pid 22352] AH00117: Ignoring deprecated use of DefaultType in line 143 of /etc/apa.../httpd.conf.
Aug 14 18:06:55 luu056d start_apache2[22352]: httpd (no pid file) not running
Aug 14 18:06:55 luu056d systemd[1]: Failed to start The Apache Webserver.
Aug 14 18:06:55 luu056d systemd[1]: apache2.service: Unit entered failed state.
Aug 14 18:06:55 luu056d systemd[1]: apache2.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
Why am I getting that error httpd (no pid file) not running
when I turn on SSLEngine
?
Nothing is blocking port 443, since when I run lsof -i :443
the result is empty.
I’m using Apache/2.4.23 for Linux/SUSE
Better Stack Team
Updated on May 4, 2022
Problem
Apache refuses to start prompting Invalid command ‘SSLEngine’Error’
Cause of the problem
This frequently happens on fresh Apache servers. When Apache starts it reads
through the configuration files. When it encounters SSLEngine
directive, it
considers it as unknown. This is caused by the fact that the server’s basic
configuration does not have mod_ssl
module installed or enabled.
Solution
On CentOS/RedHat systems
Run the following command to install mod_ssl
On Ubuntu/Debian systems
Run the following command to enable the module:
SSL module should be enabled by now.
Explore more
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.