logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: SSL Goes to the wrong DocumentRoot
Author
neo314



Joined: 05 Nov 2023
Posts: 1
Location: USA, Veneta

PostPosted: Sun 05 Nov '23 20:46    Post subject: SSL Goes to the wrong DocumentRoot Reply with quote

Hi Folks,

I have my problem solved, but I do not know why it is fixed. I have used WAMP a great deal and assorted Apache Servers on VPS. This time I was setting up Apache2 on my Ubunto 20.04 for the purpose of having a development web server on my LAN. No external access.

I enabled the default website and the default SSL config. I setup my first dev site for this server (joomladev.local), by copying and adjusting those conf files for the local domain name. The http site worked fine, but the SSL site went to the server default DocumentRoot.

Nothing I did seemed to fix the issue. At best, I could get the error “SSL_ERROR_RX_RECORD_TOO_LONG”.

However, when I just moved the same vhost settings from its own conf file to the default-ssl file, it worked just fine. I do not understand why. Is it related to the IfModule statement? That only just occurred to me.

Original (Does not work):

default-ssl.conf
Code:
<IfModule mod_ssl.c>
   <VirtualHost 192.168.0.10:443>
      ServerAdmin webmaster@localhost
      #DocumentRoot /var/www/html
        #ServerName webdev.local
      DocumentRoot /WebDev/0_server-default

      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
      
      <Directory /WebDev/0_server-default>
          Options Indexes FollowSymLinks MultiViews
          DirectoryIndex index.php index.html
#          AllowOverride None
          Require all granted
#          Options Indexes FollowSymLinks
          Allowoverride All
          Order allow,deny
          allow from all
      </Directory>

      SSLEngine on

      SSLCertificateFile   /etc/apache2/certificate/certificate.crt
      SSLCertificateKeyFile /etc/apache2/certificate/private.key


      <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
      </FilesMatch>
      <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
      </Directory>
   </VirtualHost>
</IfModule>


joomladev.conf
Code:
<IfModule mod_ssl.c>   
<VirtualHost 192.168.0.10:443>
      ServerAdmin webmaster@localhost
        ServerName joomladev.local
        ServerAlias www.joomladev.local
      DocumentRoot /WebDev/joomladev.local/public_html


      ErrorLog ${APACHE_LOG_DIR}/joomladev/error-ssl.log
      CustomLog ${APACHE_LOG_DIR}/joomladev/access-ssl.log combined
       
        <Directory /WebDev/joomladev.local>
          Options Indexes FollowSymLinks MultiViews
          DirectoryIndex index.php index.html
#          AllowOverride None
          Require all granted
#          Options Indexes FollowSymLinks
          Allowoverride All
          Order allow,deny
          allow from all
      </Directory>

      SSLEngine on

      SSLCertificateFile   /etc/apache2/certificate/joomladev.crt
      SSLCertificateKeyFile /etc/apache2/certificate/joomladev.key

      <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
      </FilesMatch>
      <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
      </Directory>
   </VirtualHost>
</IfModule>


Now works
default-ssl.conf
Code:
<IfModule mod_ssl.c>
   <VirtualHost 192.168.0.10:443>
      ServerAdmin webmaster@localhost
      #DocumentRoot /var/www/html
        #ServerName webdev.local
      DocumentRoot /WebDev/0_server-default

      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
      
      <Directory /WebDev/0_server-default>
          Options Indexes FollowSymLinks MultiViews
          DirectoryIndex index.php index.html
#          AllowOverride None
          Require all granted
#          Options Indexes FollowSymLinks
          Allowoverride All
          Order allow,deny
          allow from all
      </Directory>

      SSLEngine on

      SSLCertificateFile   /etc/apache2/certificate/certificate.crt
      SSLCertificateKeyFile /etc/apache2/certificate/private.key


      <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
      </FilesMatch>
      <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
      </Directory>
   </VirtualHost>   
        <VirtualHost 192.168.0.10:443>
      ServerAdmin webmaster@localhost
        ServerName joomladev.local
        ServerAlias www.joomladev.local
      DocumentRoot /WebDev/joomladev.local/public_html


      ErrorLog ${APACHE_LOG_DIR}/joomladev/error-ssl.log
      CustomLog ${APACHE_LOG_DIR}/joomladev/access-ssl.log combined
       
        <Directory /WebDev/joomladev.local>
          Options Indexes FollowSymLinks MultiViews
          DirectoryIndex index.php index.html
#          AllowOverride None
          Require all granted
#          Options Indexes FollowSymLinks
          Allowoverride All
          Order allow,deny
          allow from all
      </Directory>

      SSLEngine on

      SSLCertificateFile   /etc/apache2/certificate/joomladev.crt
      SSLCertificateKeyFile /etc/apache2/certificate/joomladev.key

      <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
      </FilesMatch>
      <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
      </Directory>
   </VirtualHost>
</IfModule>
[/code]
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 297
Location: UK

PostPosted: Mon 06 Nov '23 17:30    Post subject: Reply with quote

Being Ubuntu, presume you enabled your additional SSL site configuration file, joomladev.conf?

Code:
# a2ensite joomladev.conf

Is the additional configuration file listed if you query apache for your virtual hosts?

Code:
# source /etc/apache2/envvars
# /usr/sbin/apache2 -S
Back to top


Reply to topic   Topic: SSL Goes to the wrong DocumentRoot View previous topic :: View next topic
Post new topic   Forum Index -> Apache