How to upgrade Apache in DirectAdmin

Try it in our public cloud & Get $50 Credit
CLAIM NOW

DirectAdmin is a common web hosting panel used on Linux systems to graphically administer websites. You can use it in conjunction with other server software, such as Apache.

However, when using DirectAdmin with Apache, it’s important that you regularly update Apache. This will enhance your site’s security and prevent it from falling victim to any security holes that have been patched with the latest version. We’ve compiled this guide to help you quickly update your Apache installation when using DirectAdmin. You can also use it to help update any other additional software you’re using with DirectAdmin.

Getting started

Confirm that you have the following before you follow this guide:
• 1 Node (Cloud Server or Dedicated Server) with DirectAdmin and custombuild installed.
• Root access to the node or one sudo non-root user

Tutorial

First, go in the custombuild directory of your DirectAdmin installation.

cd /usr/local/directadmin/custombuild

Now, download all the latest packages your system needs. At minimum you should retrieve the latest version of Apache.

./build update

You can update Apache by typing the following command. Always make sure you have the latest version of Apache, to mitigate risk of security breach.

./build apache

Great! You’re halfway there. You will now need to rebuild your PHP installation to make sure that your files are also upgraded.

./build php n

After that’s done, the next step is to rebuild all the conf files.

./build rewrite_confs

The final task is to restart the Apache webserver, in order to apply the latest changes.

service httpd restart

Check the version. Apache should report that it’s the newest version that you downloaded. You can check your current version of Apache by typing the following command:

httpd -v

Conclusion

Building Apache for DirectAdmin is not as simple a task as simply running an apt-get or yum command, but it’s absolutely necessary for the safety of your server and any hosted material. If you’d like a quicker way to automatically update Apache, you can create a shell script that runs the above commands. If this guide was helpful to you, kindly share it with others who may also be interested.