My site is hitting error 500 i couldnt proceed when the first two lines of code on how to secure apache

My domain is:jobsdojo.com

I ran this command:
sudo apache2ctl configtest

It produced this output:
AH00526: Syntax error on line 1 of /etc/letsencrypt/options-ssl-apache.conf:
Invalid command '404:', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
My web server is (include version):

The operating system my web server runs on is (include version):
ubuntu 20
My hosting provider, if applicable, is:

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
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):

Hello @, welcome to the Let's Encrypt community. :slightly_smiling_face:

What version of Certbot?
What version of Apache?

Please post the logs and the file /etc/letsencrypt/options-ssl-apache.conf
To upload a file use this
image

2 Likes

options-ssl-apache.conf 404: Not Found... file conttains that

Kindly wait for more knowledgeable Let's Encrypt community volunteers to assist.

1 Like

i managed to install it now. yet my site is still not secure

i used snapd. site is working now but still http

How?

The file options-ssl-apache.conf should NOT contain the text "404: Not Found...". It seems something has overwritten the original contents.

3 Likes

this time it doesnt contain 404

Using this online tool SSL Server Test (Powered by Qualys SSL Labs) gets a B here SSL Server Test: jobsdojo.com (Powered by Qualys SSL Labs)

With curl -Ii
HTTPS connects but is returning "HTTP/1.1 500 Internal Server Error"

$ curl -Ii https://jobsdojo.com
HTTP/1.1 500 Internal Server Error
Date: Tue, 21 Mar 2023 20:03:40 GMT
Server: Apache/2.4.29 (Ubuntu)
Connection: close
Content-Type: text/html; charset=iso-8859-1

HTTP looks ok

$ curl -Ii http://jobsdojo.com/
HTTP/1.1 200 OK
Date: Tue, 21 Mar 2023 20:03:10 GMT
Server: Apache/2.4.29 (Ubuntu)
Content-Length: 89567
X-Frame-Options: DENY
Vary: Cookie,Accept-Encoding
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Set-Cookie: csrftoken=JD4Lyni2nF6Lh62JzHJP0OJWQIxWtSBre7TEDpvXsj43JNyGtG9xeq8VFHN6IvRG; expires=Tue, 19 Mar 2024 20:03:10 GMT; Max-Age=31449600; Path=/; SameSite=Lax
Content-Type: text/html; charset=utf-8

And the Certificate via openssl

$ openssl s_client -showcerts -servername jobsdojo.com -connect jobsdojo.com:443 < /dev/null
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = jobsdojo.com
verify return:1
---
Certificate chain
 0 s:CN = jobsdojo.com
   i:C = US, O = Let's Encrypt, CN = R3
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Mar 21 18:42:42 2023 GMT; NotAfter: Jun 19 18:42:41 2023 GMT
-----BEGIN CERTIFICATE-----
MIIFHzCCBAegAwIBAgISA6FcNg60CU8/+kTPDlBIrXeHMA0GCSqGSIb3DQEBCwUA
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD
EwJSMzAeFw0yMzAzMjExODQyNDJaFw0yMzA2MTkxODQyNDFaMBcxFTATBgNVBAMT
DGpvYnNkb2pvLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALix
Z7B7H9XX1nWpId9HPk+faNaiamg4PshypxC1n731quTtlPzUReFDma4ehsyASw2n
uamJFaINcOqmX0q3OxpR8SskHATxstnc5/8b7pYirOzKbTYrSOE5nMKfjEuo2EHv
5WIswyILkzp0DYDxSRJG0cfr/WrgzldWZ+WJW6lulDE5+ciRRkcFOq1rwf/PDdDc
CmdD2q4QOZ9STBLmIT5IETf4h8ec7N34MaqjPT/49LD/A2Vj3dMscO0MJtlm1zhZ
5fNUmwV11OaLzjyT8piXWgJp3gq+E/xJ8XU6vsjZK1zpNfTVesiGesexqWo0e72p
C92JG2jwenQKW+aV5vUCAwEAAaOCAkgwggJEMA4GA1UdDwEB/wQEAwIFoDAdBgNV
HSUEFjAUBggrBgEFBQcD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RmlFwaLywaTYQ8M+
hYrwEJ0x/oTepNL4sVI2VVrllA==
-----END CERTIFICATE-----
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Sep  4 00:00:00 2020 GMT; NotAfter: Sep 15 16:00:00 2025 GMT
-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw
WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP
R5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdx
sxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8Zutm
NHz6a4uPVymZ+DAXXbpyb/uBxa3Shlg9F8fnCbvxK/eG3MHacV3URuPMrSXBiLxg
Z3Vms/EY96Jc5lP/Ooi2R6X/ExjqmAl3P51T+c8B5fWmcBcUr2Ok/5mzk53cU6cG
/kiFHaFpriV1uxPMUgP17VGhi9sVAgMBAAGjggEIMIIBBDAOBgNVHQ8BAf8EBAMC
AYYwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMBIGA1UdEwEB/wQIMAYB
Af8CAQAwHQYDVR0OBBYEFBQusxe3WFbLrlAJQOYfr52LFMLGMB8GA1UdIwQYMBaA
FHm0WeZ7tuXkAXOACIjIGlj26ZtuMDIGCCsGAQUFBwEBBCYwJDAiBggrBgEFBQcw
AoYWaHR0cDovL3gxLmkubGVuY3Iub3JnLzAnBgNVHR8EIDAeMBygGqAYhhZodHRw
Oi8veDEuYy5sZW5jci5vcmcvMCIGA1UdIAQbMBkwCAYGZ4EMAQIBMA0GCysGAQQB
gt8TAQEBMA0GCSqGSIb3DQEBCwUAA4ICAQCFyk5HPqP3hUSFvNVneLKYY611TR6W
PTNlclQtgaDqw+34IL9fzLdwALduO/ZelN7kIJ+m74uyA+eitRY8kc607TkC53wl
ikfmZW4/RvTZ8M6UK+5UzhK8jCdLuMGYL6KvzXGRSgi3yLgjewQtCPkIVz6D2QQz
CkcheAmCJ8MqyJu5zlzyZMjAvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm
lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4
avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2
yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O
yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
   a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
   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+GOdwiK1O5tmLOsbdJ1Fu/7xk9TND
TwIDAQABo4IBRjCCAUIwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
SwYIKwYBBQUHAQEEPzA9MDsGCCsGAQUFBzAChi9odHRwOi8vYXBwcy5pZGVudHJ1
c3QuY29tL3Jvb3RzL2RzdHJvb3RjYXgzLnA3YzAfBgNVHSMEGDAWgBTEp7Gkeyxx
+tvhS5B1/8QVYIWJEDBUBgNVHSAETTBLMAgGBmeBDAECATA/BgsrBgEEAYLfEwEB
ATAwMC4GCCsGAQUFBwIBFiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQu
b3JnMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6Ly9jcmwuaWRlbnRydXN0LmNvbS9E
U1RST09UQ0FYM0NSTC5jcmwwHQYDVR0OBBYEFHm0WeZ7tuXkAXOACIjIGlj26Ztu
MA0GCSqGSIb3DQEBCwUAA4IBAQAKcwBslm7/DlLQrt2M51oGrS+o44+/yQoDFVDC
5WxCu2+b9LRPwkSICHXM6webFGJueN7sJ7o5XPWioW5WlHAQU7G75K/QosMrAdSW
9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuG
WCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O
he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
---
Server certificate
subject=CN = jobsdojo.com
issuer=C = US, O = Let's Encrypt, CN = R3
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 4571 bytes and written 394 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
DONE
1 Like

yes. http works fine

Your are serving a Let's Encrypt Certificate properly; the main goal to the forum to my knowledge.

Here details on Apache can be found in documentation and forums:

Kindly wait to see if there are more knowledgeable Let's Encrypt community volunteers willing to assist.

1 Like

okay. thanks

2 Likes

We have no clue what has happened, as we're lacking information, even when asked about it.

Certbot usually can add the HTTP to HTTPS redirect, but that will only happen when the apache authenticator is used. As options-ssl-apache.conf was in use, this suggests some use of the apache authenticator. Maybe Certbot had some issues with the Apache configuration or something else has happend. Which wouldn't surprise me, as the contents of options-ssl-apache.conf were modified also.

Please post the output of:

sudo apache2ctl -t -D DUMP_VHOSTS
4 Likes

VirtualHost configuration:
*:443 jobsdojo.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
*:80 jobsdojovm.europe-west2-c.c.jobsdojo-378008.internal (/etc/apache2/sites-enabled/000-default.conf:1)

1 Like
# This file contains important security parameters. If you modify this file
# manually, Certbot will be unable to automatically provide future security
# updates. Instead, Certbot will print and log an error message with a path to
# the up-to-date file that you will need to refer to when manually updating
# this file.

SSLEngine on

# Intermediate configuration, tweak to your needs
SSLProtocol             all -SSLv2 -SSLv3
SSLCipherSuite          ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLHonorCipherOrder     on
SSLCompression          off

SSLOptions +StrictRequire

# Add vhost name to log entries:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

#CustomLog /var/log/apache2/access.log vhost_combined
#LogLevel warn
#ErrorLog /var/log/apache2/error.log

# Always ensure Cookies have "Secure" set (JAH 2012/1)
#Header edit Set-Cookie (?i)^(.*)(;\s*secure)??((\s*;)?(.*)) "$1; Secure$3$4"

That's weird: where is the HTTP (port 80) virtualhost for jobsdojo.com gone to? Could you post the contents of /etc/apache2/sites-enabled/000-default.conf?

3 Likes
<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com
	#ServerName www.jobsdojo.com
	#ServerAlias jobsdojo.com       
	ServerAdmin webmaster@localhost

        
	DocumentRoot /var/www/blog


   	 Alias /static /var/www/blog/static
   	 <Directory /var/www/blog/static>
       		 Require all granted
   	 </Directory>




   	 <Directory /var/www/blog/blog>
       	 <Files wsgi.py>
            Require all granted
       	 </Files>
  	 </Directory>


   	 WSGIDaemonProcess blog python-path=/var/www/blog/:/usr/bin/python3/
   	 WSGIProcessGroup blog
   	 WSGIScriptAlias / /var/www/blog/blog/wsgi.py
        
	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:war
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.con
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Hmkay, so no redirect added by Certbot.

Any reason why this is commented? When commented, Certbot probably can't find the vhost to add a redirect. However, as 000-default-le-ssl.conf is based on 000-default.conf it must have been uncommented before. So I don't understand. It looks like much was manually edited after Certbot was used?

3 Likes

so i should uncomment it?

it is actually uncommented in sites-available.