How To Install Apache On Debian 13 Trixie
Apache is one of the most popular and reliable web servers in the world. Many developers and system administrators still choose Apache because of its stability, flexibility, and wide community support. If you're running a VPS or dedicated server based on Debian 13 (Trixie), installing Apache is straightforward and only takes a few minutes.
This guide will walk you step-by-step through the full installation and basic configuration of Apache on Debian 13.
1. Update Your System
Before installing any packages, always update your system repository to ensure you get the latest stable version of software.
sudo apt update
sudo apt upgrade -y2. Install Apache Web Server
Debian 13 provides Apache through its official repository. Install it using :
sudo apt install apache2 -yThis command installs :
- apache2
- apache2-utils
- apache2-bin
- required dependencies
3. Start And Enable Apache
After installation, Apache usually starts automatically. You can check its status :
sudo systemctl status apache2To ensure Apache starts automatically at boot :
sudo systemctl enable apache2To manually control the service :
sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache2
sudo systemctl reload apache24. Allow Apache Through the Firewall (UFW)
If your server uses UFW, allow HTTP and HTTPS traffic :
sudo ufw allow 'Apache Full'
sudo ufw reloadCheck allowed rules :
sudo ufw status5. Verify Apache Installation
Open your browser and visit your server IP address :
http://YOUR_SERVER_IPIf Apache is working, you will see the default Apache2 Debian Default Page.
Alternatively, test with :
curl http://localhost6. Manage Virtual Hosts
Virtual hosts allow you to host multiple domains on one server.
Create a directory for your website :
sudo mkdir -p /var/www/example.com/public_htmlSet ownership :
sudo chown -R $USER:$USER /var/www/example.com/public_htmlCreate a sample index.html :
echo "Welcome to example.com" > /var/www/example.com/public_html/index.htmlCreate a new virtual host file :
sudo nano /etc/apache2/sites-available/example.com.confAdd the following :
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
<Directory /var/www/example.com/public_html>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/example_error.log
CustomLog ${APACHE_LOG_DIR}/example_access.log combined
</VirtualHost>Enable the virtual host :
sudo a2ensite example.com.confDisable the default site (optional) :
sudo a2dissite 000-default.confReload Apache :
sudo systemctl reload apache27. Enable .htaccess Support (Optional)
If you need '.htaccess' support (for CMS like WordPress or frameworks like Laravel) :
sudo nano /etc/apache2/apache2.confFind :
AllowOverride NoneChange to :
AllowOverride AllSave and reload :
sudo systemctl reload apache28. Enable Useful Apache Modules
Common modules you may want :
Enable rewrite module (SEO-friendly URLs) :
sudo a2enmod rewrite
sudo systemctl restart apache2Enable SSL module :
sudo a2enmod sslEnable headers module :
sudo a2enmod headers9. Check Apache Configuration
Before restarting Apache, always check for syntax errors :
sudo apache2ctl configtestExpected result :
Syntax OK10. Uninstalling Apache (If Needed)
If you ever need to remove Apache :
sudo apt remove apache2 -y
sudo apt purge apache2 -y
sudo apt autoremove -yConclusion
Installing Apache on Debian 13 is simple and fast. Once installed, you can begin deploying websites, configuring virtual hosts, enabling modules, and securing your server with SSL. Apache remains a powerful and flexible solution for small websites, enterprise-level applications, and everything in between.







