My HTTP website is running on Apache HTTP Server in Oracle Linux 8, how can I configure my ssl.conf?

My domain is: fdny.myconcierge.ga

I ran this command: sudo systemctl status httpd.service

It produced this output:
May 10 12:31:12 nyc-test-server httpd[2498162]: AH00526: Syntax error on line 6 of /etc/httpd/conf.d/ssl.conf:
May 10 12:31:12 nyc-test-server httpd[2498162]: Cannot define multiple Listeners on the same IP:port
May 10 12:31:12 nyc-test-server systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
May 10 12:31:12 nyc-test-server systemd[1]: httpd.service: Failed with result 'exit-code'.
May 10 12:31:12 nyc-test-server systemd[1]: Failed to start The Apache HTTP Server.

My web server is (include version):

The operating system my web server runs on is (include version):

My hosting provider, if applicable, is: Apache/2.4.37

I can login to a root shell on my machine (yes or no, or I don't know): Yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no/idk

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): 2.6.0

Here's my ssl.conf:

#
# When we also provide SSL we have to listen to the 
# standard HTTPS port in addition.
#
LoadModule ssl_module modules/mod_ssl.sl
Listen 443 https

##
##  SSL Global Context
##
##  All SSL configuration in this context applies both to
##  the main server and all SSL-enabled virtual hosts.
##

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin' is a internal
#   terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog

#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism 
#   to use and second the expiring timeout (in seconds).
SSLSessionCache         shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout  300

#
# Use "SSLCryptoDevice" to enable any supported hardware
# accelerators. Use "openssl engine -v" to list supported
# engine names.  NOTE: If you enable an accelerator and the
# server does not start, consult the error logs and ensure
# your accelerator is functioning properly. 
#
SSLCryptoDevice builtin
#SSLCryptoDevice ubsec

##
## SSL Virtual Host Context
##

<VirtualHost _default_:443>

# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html"
#ServerName www.example.com:443

# Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf.
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   List the protocol versions which clients are allowed to connect with.
#   The OpenSSL system profile is used by default.  See
#   update-crypto-policies(8) for more details.
#SSLProtocol all -SSLv3
#SSLProxyProtocol all -SSLv3

#   User agents such as web browsers are not configured for the user's
#   own preference of either security or performance, therefore this
#   must be the prerogative of the web server administrator who manages
#   cpu load versus confidentiality, so enforce the server's cipher order.
SSLHonorCipherOrder on

#   SSL Cipher Suite:
#   List the ciphers that the client is permitted to negotiate.
#   See the mod_ssl documentation for a complete list.
#   The OpenSSL system profile is configured by default.  See
#   update-crypto-policies(8) for more details.
SSLCipherSuite PROFILE=SYSTEM
SSLProxyCipherSuite PROFILE=SYSTEM

#   Point SSLCertificateFile at a PEM encoded certificate.  If
#   the certificate is encrypted, then you will be prompted for a
#   pass phrase.  Note that restarting httpd will prompt again.  Keep
#   in mind that if you have both an RSA and a DSA certificate you
#   can configure both in parallel (to also allow the use of DSA
#   ciphers, etc.)
#   Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
#   require an ECC certificate which can also be configured in
#   parallel.
SSLCertificateFile /etc/letsencrypt/live/fdny.myconcierge.ga/fullchain.pem

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
#   ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile /etc/letsencrypt/live/fdny.myconcierge.ga/privkey.pem

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convenience.
SSLCertificateChainFile /etc/letsencrypt/live/fdny.myconcierge.ga/chain.pem

#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt

#   Client Authentication (Type):
#   Client certificate verification type and depth.  Types are
#   none, optional, require and optional_no_ca.  Depth is a
#   number which specifies how deeply to verify the certificate
#   issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth  10

#   Access Control:
#   With SSLRequire you can do per-directory access control based
#   on arbitrary complex boolean expressions containing server
#   variable checks and other lookup directives.  The syntax is a
#   mixture between C and Perl.  See the mod_ssl documentation
#   for more details.
#<Location />
#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
#            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
#            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
#            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
#            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
#           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
#</Location>

#   SSL Engine Options:
#   Set various options for the SSL engine.
#   o FakeBasicAuth:
#     Translate the client X.509 into a Basic Authorisation.  This means that
#     the standard Auth/DBMAuth methods can be used for access control.  The
#     user name is the `one line' version of the client's X.509 certificate.
#     Note that no password is obtained from the user. Every entry in the user
#     file needs this password: `xxj31ZMTZzkVA'.
#   o ExportCertData:
#     This exports two additional environment variables: SSL_CLIENT_CERT and
#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
#     server (always existing) and the client (only existing when client
#     authentication is used). This can be used to import the certificates
#     into CGI scripts.
#   o StdEnvVars:
#     This exports the standard SSL/TLS related `SSL_*' environment variables.
#     Per default this exportation is switched off for performance reasons,
#     because the extraction step is an expensive operation and is usually
#     useless for serving static content. So one usually enables the
#     exportation for CGI and SSI requests only.
#   o StrictRequire:
#     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
#     under a "Satisfy any" situation, i.e. when it applies access is denied
#     and no other module can change it.
#   o OptRenegotiate:
#     This enables optimized SSL connection renegotiation handling when SSL
#     directives are used in per-directory context. 
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/var/www/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>

#   SSL Protocol Adjustments:
#   The safe and default but still SSL/TLS standard compliant shutdown
#   approach is that mod_ssl sends the close notify alert but doesn't wait for
#   the close notify alert from client. When you need a different shutdown
#   approach you can use one of the following variables:
#   o ssl-unclean-shutdown:
#     This forces an unclean shutdown when the connection is closed, i.e. no
#     SSL close notify alert is sent or allowed to be received.  This violates
#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
#     this when you receive I/O errors because of the standard approach where
#     mod_ssl sends the close notify alert.
#   o ssl-accurate-shutdown:
#     This forces an accurate shutdown when the connection is closed, i.e. a
#     SSL close notify alert is sent and mod_ssl waits for the close notify
#     alert of the client. This is 100% SSL/TLS standard compliant, but in
#     practice often causes hanging connections with brain-dead browsers. Use
#     this only for browsers where you know that their SSL implementation
#     works correctly. 
#   Notice: Most problems of broken clients are also related to the HTTP
#   keep-alive facility, so you usually additionally want to disable
#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
#   "force-response-1.0" for this.
BrowserMatch "MSIE [2-5]" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

Can you help me point out what is wrong with my ssl.conf? I am listening at 443, I tried to change it to a different number before but it also didn't work.

Any help is very much appreciated. Cheers!

This is not the correct Listen syntax, please see the Apache documentation.

Please note that if fullchain.pem is used for SSLCertificateFile, there is no need to supply the chain separately for Apache versions of 2.4.8 or higher.

4 Likes

You should also check whether you have that listen setting in your main httpd config file or some other config file. That might explain the error about duplicate ports. You should also add a ServerName in that virtual host for your domain name. That wouldn't cause this port error but is good practice

11 Likes

I removed the 'https' based on the Apache Documentation SSL: How-to and just used

...
Listen 443
...

But it still prompts the same error, am I missing something here?

Did you check the /etc/httpd/conf/httpd.conf to see if it already had that listen ?

If you did and no conflict, what does this say

sudo httpd -t -D DUMP_VHOSTS
10 Likes

I checked the /etc/httpd/conf/httpd.conf but it's listening to port 80.

...
Listen 80
...

Should I remove this line? Also, I used that

sudo httpd -t -D DUMP_VHOSTS

command and it says the same thing:

[Wed May 10 14:56:11.332425 2023] [so:warn] [pid 2542102:tid 140649881569600] AH01574: module ssl_module is already loaded, skipping
[Wed May 10 14:56:11.334265 2023] [so:warn] [pid 2542102:tid 140649881569600] AH01574: module ssl_module is already loaded, skipping
AH00526: Syntax error on line 6 of /etc/httpd/conf.d/ssl.conf:
Cannot define multiple Listeners on the same IP:port

What does this show?

ls -l /etc/httpd/conf.d
9 Likes

It shows this:
image

Check all of those for a listen 443

You probably have it multiple places but the main listen should only appear once

10 Likes

grep -Ri listen /etc/httpd could help with that.

5 Likes

I found the one in ../conf.modules.d that is listening to the same port:


Should I change the one inside the ../conf.modules.d, if so, can I change it to anything?

We aren't a general Apache support forum. It is unusual to see the kind of duplicate settings like you have. Oracle has some good docs on configuring Apache.

12 Likes

I tried some digging and it turns out that we usually use the configs inside ../conf.modules.d/ so I commented the 'Listen 443' in my ../conf.d/ssl.conf and I am no longer getting the error when I check for it's status:

image

However, when I try to visit my page with an https, I am getting the following:

This site can’t be reached

The connection was reset.

Try:

* Checking the connection
* [Checking the proxy and the firewall](chrome-error://chromewebdata/#buttons)

ERR_CONNECTION_RESET

Any idea on steps that I might have missed?

I can reach your domain with HTTP but not HTTPS. And, based on your systemctl status it doesn't look like Apache is listening on port 443.

What do these show:

sudo httpd -t -D DUMP_VHOSTS

sudo netstat -pant | grep -Ei 'httpd|:80|:443'
11 Likes

Here's the responses from the command:

sudo httpd -t -D DUMP_VHOSTS
image

sudo netstat -pant | grep -Ei 'httpd|:80|:443'

tcp        0      0 10.0.0.116:44868        169.254.169.254:80      ESTABLISHED 3183/runcommand
tcp        1      0 10.0.0.116:51540        169.254.169.254:80      CLOSE_WAIT  2679/osms-agent
tcp        0      0 10.0.0.116:59518        169.254.169.254:80      ESTABLISHED 3219/osmsv2
tcp        0      0 10.0.0.116:47878        169.254.169.254:80      TIME_WAIT   -
tcp        0      0 10.0.0.116:49700        130.35.101.82:443       TIME_WAIT   -
tcp        0      0 10.0.0.116:59526        169.254.169.254:80      ESTABLISHED 3183/runcommand
tcp        0      0 10.0.0.116:44330        140.91.12.72:443        ESTABLISHED 3183/runcommand
tcp        0      0 10.0.0.116:47462        169.254.169.254:80      ESTABLISHED 3183/runcommand
tcp        0      0 10.0.0.116:47894        169.254.169.254:80      ESTABLISHED 3183/runcommand
tcp        0      0 10.0.0.116:42446        169.254.169.254:80      ESTABLISHED 3183/runcommand
tcp        0      0 10.0.0.116:56124        169.254.169.254:80      ESTABLISHED 3183/runcommand
tcp        0      0 10.0.0.116:37588        147.154.13.111:443      ESTABLISHED 3219/osmsv2
tcp        0      0 10.0.0.116:36164        130.35.101.82:443       TIME_WAIT   -
tcp        0      0 10.0.0.116:56118        169.254.169.254:80      ESTABLISHED 2243/gomon
tcp        0      0 10.0.0.116:47874        169.254.169.254:80      TIME_WAIT   -
tcp        0      0 10.0.0.116:37574        147.154.13.111:443      ESTABLISHED 3219/osmsv2
tcp        0      0 10.0.0.116:53670        169.254.169.254:80      ESTABLISHED 3183/runcommand
tcp        0      0 10.0.0.116:36150        130.35.101.82:443       TIME_WAIT   -
tcp       32      0 10.0.0.116:59500        129.213.0.145:443       CLOSE_WAIT  2679/osms-agent
tcp        0      0 10.0.0.116:36168        130.35.101.82:443       TIME_WAIT   -
tcp        1      0 10.0.0.116:51554        169.254.169.254:80      CLOSE_WAIT  2679/osms-agent
tcp6       0      0 :::80                   :::*                    LISTEN      2927614/httpd
tcp6       0      0 10.0.0.116:36254        140.91.11.146:443       ESTABLISHED 2777/oracle.polaris
tcp6       0      0 10.0.0.116:57134        147.154.13.111:443      ESTABLISHED 2777/oracle.polaris
tcp6      32      0 10.0.0.116:35906        129.213.0.145:443       CLOSE_WAIT  2777/oracle.polaris
tcp6       0      0 10.0.0.116:36252        140.91.11.146:443       ESTABLISHED 2777/oracle.polaris
tcp6       0      0 10.0.0.116:36260        140.91.11.146:443       ESTABLISHED 2777/oracle.polaris

Looks like you still have some major problem with your Apache config. You have two VirtualHosts handling the same domain name. That is wrong. And, there is duplication of loading your ssl module. And, nothing is listening on port 443 even after your changes.

We often help people adjust their Apache config but your problem is more extensive problem of setting up Apache. That should be resolved on an Apache forum or studying your Oracle Apache docs.

You can see from the netstat report that httpd is listening on port 80 but not 443. A shorter netstat report is below. When you change Apache this will help you know if it is listening.

sudo netstat -pant | grep -i listen | grep -Ei 'httpd|:80|:443'

Maybe some other volunteer here will offer help but this is well beyond what I can offer on this forum.

12 Likes

It can listen on port 80.
But, from the vhost dump, it seems that there are no vhosts set to listen on port 80.

10 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.