Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: Migrating from HTTPD on CentOS to Apache2 on Ubuntu |
|
| Author |
|
gw1500se
Joined: 03 Dec 2014 Posts: 5
|
Posted: Mon 16 Feb '26 18:47 Post subject: Migrating from HTTPD on CentOS to Apache2 on Ubuntu |
|
|
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: 421 Location: UK
|
Posted: Wed 18 Feb '26 22:22 Post subject: |
|
|
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 |
|
|
|
|
|
|