My domain is: development.newcardeals.co.za
I ran this command: N/A
It produced this output: N/A
My web server is (include version):
Server version: Apache/2.4.58 (Ubuntu)
Server built: 2024-07-11T14:41:54
The operating system my web server runs on is (include version):
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
My hosting provider, if applicable, is: This is an AWS EC2 instance.
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):
certbot 2.11.0
Additional Context
I'm testing SSL certificate installation on a development environment i.e. dev.bar.co.za using HTTP. NB: bar is 'newcardeals'
and dev is 'development'
.
This is an error displayed after installing an SSL certificate through Let's Encrypt and accessing pages other than the home page.
"the requested url was not found on this server ... apache (ubuntu) server at dev.bar.co.za port 443"
This is /etc/apache2/sites-available/bar.conf
<VirtualHost *:80>
CustomLog ${APACHE_LOG_DIR}/access.log combined
DocumentRoot /path/to/the/app/dir/
ErrorLog ${APACHE_LOG_DIR}/error.log
RewriteEngine on
RewriteCond %{SERVER_NAME} =dev.bar.co.za
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ServerAdmin webmaster@localhost
ServerName dev.bar.co.za
</VirtualHost>
And this is /etc/apache2/sites-available/bar-le-ssl.conf
<VirtualHost *:443>
CustomLog ${APACHE_LOG_DIR}/access.log combined
DocumentRoot /path/to/the/app/dir/
ErrorLog ${APACHE_LOG_DIR}/error.log
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/dev.bar.co.za/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/dev.bar.co.za/privkey.pem
ServerAdmin webmaster@localhost
ServerName dev.bar.co.za
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
This is the output of running sudo apache2ctl configtest
$ Syntax OK
This is the output of running sudo a2ensite bar.conf
and sudo a2ensite bar-le-ssl.conf
.
$ Site bar already enabled
$ Site bar-le-ssl already enabled
In addition, I can see symbolic links confirming the output below when I run sudo ls -al /etc/apache2/
This is the output of running sudo apache2ctl -M | grep ssl
.
$ ssl_module (shared)
Unless if I'm wrong, the missing SSLEngine on
line in bar-le-ssl.conf
shouldn't be a problem. apache2ctl -M | grep ssl
output confirms that the ssl
module is loaded, so the configuration seems to be picking it up from there.
This is the output of running sudo a2enmod rewrite
$ Module rewrite already enabled
This is the output of running tail /var/apache2/error.log
.
[Thu May 12 ...] [mpm_prefork:notice] [pid 55358] AH00163: Apache/2.4.58 (Ubuntu) OpenSSL/3.0.13 configured -- resuming normal operations
[Thu May 12 ...] [core:notice] [pid 55358] AH00094: Command line: '/usr/sbin/apache2'
[Thu May 12 ...] [mpm_prefork:notice] [pid 55358] AH00170: caught SIGWINCH, shutting down gracefully
[Thu May 12 ...] [mpm_prefork:notice] [pid 59090] AH00163: Apache/2.4.58 (Ubuntu) OpenSSL/3.0.13 configured -- resuming normal operations
[Thu May 12 ...] [core:notice] [pid 59090] AH00094: Command line: '/usr/sbin/apache2'
[Thu May 12 ...] [core:error] [pid 59481] [client 120.x.y.z:44096] AH10244: invalid URI path (/cgi-bin/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/bin/sh)
[Thu May 12 ...] [core:error] [pid 59482] [client 120.x.y.z:47068] AH10244: invalid URI path (/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/bin/sh)
The error messages in /var/apache2/error.log
don't seem related to the issue I'm facing.
Fixes I've Tried
- Verify DocumentRoot: Double-check that the DocumentRoot in
bar-le-ssl.conf
points to the actual directory containing your application files. - Restart Apache: After making any configuration changes. Run
sudo systemctl restart apache2
to apply them. - Temporarily Disable Rewrite Rule: Try commenting out the rewrite rule in
bar.conf
and observe the behavior. If it fixes the issue, investigate application-level rewrite rules.