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: Migrating from HTTPD on CentOS to Apache2 on Ubuntu
Author
gw1500se



Joined: 03 Dec 2014
Posts: 8

PostPosted: Mon 16 Feb '26 18:47    Post subject: Migrating from HTTPD on CentOS to Apache2 on Ubuntu Reply with quote

I have apache2 working on Ubuntu with the exception of mysql. I tried simply copying the HTTPD config into sites-available but get a syntax error on the loadmodule directives. There is no modules directory so obviously the migration is not as straight forward as I hoped. How do I load the mysql modules? TIA.

Here is the relevant code from the HTTPD configuration (the second directory does not use mysql but I left it in case that will cause an error as well).

Code:
.
.
.
</VirtualHost>
LoadModule dbd_module modules/mod_dbd.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
        <IfModule mod_dbd.c>
                DBDriver mysql
                DBDParams "dbname=mydb user=apache pass=passwd"
                DBDMin 1
                DBDKeep 8
                DBDMax 20
        </IfModule>

        <Directory "/var/www/html/cufs/cufsauth/">
                AuthName "blah blah"
                AuthType Basic
                require valid-user
                AuthBasicProvider dbd
                AuthDBDUserPWQuery "SELECT pwd FROM tablename WHERE username=%s"
        </Directory>

        <Directory "/var/www/html/backupmgr/">
                AuthType Basic
                AuthName "Backup Manager Administration"
                AuthUserFile "/var/www/passwords"
                Require valid-user
        </Directory>
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 425
Location: UK

PostPosted: Wed 18 Feb '26 22:22    Post subject: Reply with quote

Apache on Ubuntu (Debian based) uses a different method of managing Apache server configuration, particularly with regard to modules, virtual hosts (sites), etc.

The start of the apache2.conf file provides an overview of how this configuration concept works. The net contains any amount of advice and worked examples.
Code:
#       /etc/apache2/
#       |-- apache2.conf
#       |       `--  ports.conf
#       |-- mods-enabled
#       |       |-- *.load
#       |       `-- *.conf
#       |-- conf-enabled
#       |       `-- *.conf
#       `-- sites-enabled
#               `-- *.conf

With regard to your database related modules, you need to enable them with the 'a2enmod' command, which will create the appropriate symbolic links in /etc/apache2/mods_enabled; viz:
Code:
root@atropos:~# a2enmod *dbd*
Considering dependency dbd for authn_dbd:
Enabling module dbd.
Enabling module authn_dbd.
Considering dependency dbd for authz_dbd:
Module dbd already enabled
Considering dependency authz_core for authz_dbd:
Module authz_core already enabled
Enabling module authz_dbd.
Module dbd already enabled
Considering dependency session for session_dbd:
Enabling module session.
Enabling module session_dbd.
To activate the new configuration, you need to run:
  systemctl restart apache2

root@atropos:~# ls -la /etc/apache2/mods-enabled/*dbd*
lrwxrwxrwx 1 root root 32 Feb 18 20:01 /etc/apache2/mods-enabled/authn_dbd.load -> ../mods-available/authn_dbd.load
lrwxrwxrwx 1 root root 32 Feb 18 20:01 /etc/apache2/mods-enabled/authz_dbd.load -> ../mods-available/authz_dbd.load
lrwxrwxrwx 1 root root 26 Feb 18 20:01 /etc/apache2/mods-enabled/dbd.load -> ../mods-available/dbd.load
lrwxrwxrwx 1 root root 34 Feb 18 20:01 /etc/apache2/mods-enabled/session_dbd.load -> ../mods-available/session_dbd.load

When you restart Apache, it should load these modules.

With regard to your virtual host, you should define a named configuration in /etc/apache2/sites-available and then enable it with a2ensite.

I too had to abandon moving to Centos Stream, since my AMD CPU doesn't support the x86-64-v3 instruction set, which is apparently a pre-requisite - they've rather shot themselves in the foot there. Hence the move to Ubuntu.

Good luck with your migration!
Back to top
gw1500se



Joined: 03 Dec 2014
Posts: 8

PostPosted: Sat 21 Feb '26 19:29    Post subject: Reply with quote

Thanks for the reply. It appears the modules are enabled. However, the syntax of my virtual host is still getting syntax errors. I found this page https://www.debuntu.org/how-to-apache2-authentication-using-mysql-backend-page-2/ but I cannot find what those directives are in the apache docs.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7462
Location: EU, Germany, Next to Hamburg

PostPosted: Sun 22 Feb '26 22:41    Post subject: Reply with quote

run apache2ctl -S to check the syntax inclusive the hosts.
apache2ctl -M to check the loaded modules.

If that doesn't work use

Code:

sudo su
source /etc/apache2/envvars
/usr/sbin/apache2ctl -S
/usr/sbin/apache2ctl -M
Back to top
gw1500se



Joined: 03 Dec 2014
Posts: 8

PostPosted: Mon 23 Feb '26 18:55    Post subject: Reply with quote

Thanks for the reply. Those were a big help.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7462
Location: EU, Germany, Next to Hamburg

PostPosted: Mon 23 Feb '26 19:50    Post subject: Reply with quote

Do you mind to share what the problem was?
Back to top
gw1500se



Joined: 03 Dec 2014
Posts: 8

PostPosted: Tue 24 Feb '26 18:12    Post subject: Reply with quote

Yes, the log directive was pointing to /var/log/httpd (left over from the) CentOS platform. That no longer existed under Ubuntu/Apache2. All I had to do was change it to /dev/log/apache2 and everything started working. I would never have thought of that or saw it without those commands.
Back to top


Reply to topic   Topic: Migrating from HTTPD on CentOS to Apache2 on Ubuntu View previous topic :: View next topic
Post new topic   Forum Index -> Apache