I have Apache 2.4.6 installed on RHEL 7 and it works fine without SSL. Since I am doing this for the first time, I have few questions:

The doc here says that my SSL Configuration (which I believehttpd.conf) must contain the following entries:

LoadModule ssl_module modules/mod_ssl.so

Listen 443
<VirtualHost *:443>
    ServerName www.example.com
    SSLEngine on
    SSLCertificateFile "/path/to/www.example.com.cert"
    SSLCertificateKeyFile "/path/to/www.example.com.key"

I have searched my httpd.conf for the lines <VirtualHost> and LoadModule but couldn't find it. I was under assumption that they might have commented out and I would need to uncomment it and make changes but both the lines doesnt' exist.

1) Can I copy and paste above two entries at the end of my file and configure or is it an abnormal thing that I didn't see above things commented out?

2) From where I can figure out if I have mod_ssl.so present somewhere in my Apache or not?

3) Right now, my listen is defined as follows :Listen XX.XX.XXX.XX:80where XX.XX.XXX.XX is my server IP address. Should I comment it out and completely change it to XX.XX.XXX.XX:443 ? The documentation just says Listen 443 and hence I am confused.



1> You can simply append to your /etc/httpd/conf/httpd.conf, but it might be a better idea to have the configuration for this specific virtualhost in its own configuration file in /etc/httpd/conf.d/example.com.ssl.conf or /etc/httpd/sites-available (with a corresponding symlink in /etc/httpd/sites-enabled), depending upon how your system's Apache configuration paradigm is laid out (former is RHEL; latter is Debian).

2> The simplest way is a simple grep (grep -R '[^#]*mod_ssl\.so' /etc/httpd/* to find any non-commented-out reference to that module, for instance.

3> From the Apache documentation:

Listen Directive

Description: IP addresses and ports that the server listens to

Syntax: Listen [IP-address:]portnumber [protocol]

The Listen directive instructs Apache httpd to listen to only specific IP addresses or ports; by default it responds to requests on all IP interfaces. Listen is now a required directive. If it is not in the config file, the server will fail to start. This is a change from previous versions of Apache httpd.

The Listen directive tells the server to accept incoming requests on the specified port or address-and-port combination. If only a port number is specified, the server listens to the given port on all interfaces. If an IP address is given as well as a port, the server will listen on the given port and interface.

If you say Listen 443, Apache will heed all HTTP requests on all interfaces; if you say Listen, it will only listen for HTTPS requests on the network interface bound to the IP address

| improve this answer | |
  • CentOS and thus I believe RH supplies the default SSL config in conf.d/ssl.conf.from package mod_ssl -- and if that package isn't installed this won't work at all. – dave_thompson_085 Mar 8 '17 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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