404 not found error Admin page after SSL

I followed to build a web server tutorial and successfully installed it on my server. After that I installed SSL certificate with certbot package and configured some setting backend and core_config table.
I can access websites except the admin page after SSL.
Am I need setup something in apache server or in .htaccess ?
magento 2.4.1

What i did for fixing attempt ?

sudo vi /etc/apache2/apache2.conf

    change the piece of code:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

    for this one:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

But nothing changed.

I think found the solution so what I change on my server;
First of all changed the secure_admin configuration to “0” from “1” in core_config_table for accessing to admin page wihout SSL.

& you can open magento2.com.conf file using nano command.

sudo nano /etc/apache2/sites-available/magento2.com.conf
<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName magento2.com
    ServerAlias www.magento2.com
    DocumentRoot /var/www/html/magento2
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /var/www/html/magento2>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

Step 3: Enable virtual host configuration files

From command line: sudo a2ensite magento2.com.conf

Step 4: start apache service

From command line: sudo service apache2 restart

Step 5: add host entry

From command line: sudo nano /etc/hosts

add below line in hosts file magento2.com

Restart apache server.

Now I can access admin page without SSL and for this time changed all setting one by one.
(First off changed secure url link after that secure admin like so… every settings one by one )

After these setup I can access with SSL all of page and admin.

  • Take a backup of httpd.conf file (default location /usr/local/apache2/conf/)
  • Open the file with the vi editor and ensure mod_ssl module & httpd-ssl.conf exists and not commented
LoadModule ssl_module modules/mod_ssl.so 
Include conf/extra/httpd-ssl.conf


We will use httpd-ssl.conf file to configure the certificate details. There are the following you need to ensure it exists the right parameters.

  1. SSLCertificateFile – Certificate CRT file path which you downloaded earlier
  2. SSLCertificateKeyFile – private.a key file path
  3. SSLCertificateChainFile – ca_bundle.crt file path

Tip: you may want to create a new folder called “ssl” and keep all the certificate-related files in this.

  • Take a backup if needed and use the vi editor to modify the file.
SSLCertificateFile "/usr/local/apache2/conf/ssl/certificate.crt"
SSLCertificateChainFile "/usr/local/apache2/conf/ssl/ca_bundle.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/ssl/private.key"

Configure the block for the SSL-enabled site
Below is a very simple example of a virtual host configured for SSL. The parts listed in blue are the parts you must add for SSL configuration.

    DocumentRoot /var/www/html2
    ServerName www.yourdomain.com
        SSLEngine on
        SSLCertificateFile /path/to/your_domain_name.crt
        SSLCertificateKeyFile /path/to/your_private.key
        SSLCertificateChainFile /path/to/DigiCertCA.crt
  1. Make sure to adjust the file names to match your certificate files.
    * SSLCertificateFile is your DigiCert certificate file (e.g., your_domain_name.crt).
    * SSLCertificateKeyFile is the .key file generated when you created the CSR (e.g., your_private.key).
    * SSLCertificateChainFile is the DigiCert intermediate certificate file (e.g., DigiCertCA.crt)

Note: If the SSLCertificateChainFile directive does not work, try using the SSLCACertificateFile directive instead.

  • Restart the Apache Webserver
cd /usr/local/apache2/bin 
./apachectl stop 
./apachectl start

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