Skip to main content
Home
Admin Recipes

Main navigation

  • Home
  • Contact

Breadcrumb

  1. Home

Configuring Apache Server on Debian

Configuring Apache Server on Debian

onfiguring an Apache server on Debian is a crucial step in setting up a stable and secure website. Below are the steps to install and configure Apache on Debian.

Step 1: System Update

It's recommended to start by updating your system:

sudo apt update && sudo apt upgrade -y

Step 2: Install Apache

Installing the Apache server is straightforward:

sudo apt install apache2 -y

Step 3: Check Apache Status

After installation, check if Apache is running correctly:

sudo systemctl status apache2

Step 4: Configure Firewall

Ensure the firewall allows HTTP and HTTPS traffic:

sudo ufw allow 'Apache Full'

Step 5: Test Installation

Open a web browser and navigate to http://<server_IP_address>. You should see the default Apache welcome page.

Step 6: Configure Virtual Hosts

To add a new site, create a configuration file in /etc/apache2/sites-available/:

sudo nano /etc/apache2/sites-available/mysite.conf

Sample configuration:

<VirtualHost *:80>
ServerAdmin admin@mysite.com
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /var/www/mysite
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Step 7: Enable Virtual Host and Restart Apache

Enable the new site and restart Apache:

sudo a2ensite mysite.conf
sudo systemctl restart apache2

Your Apache server is now configured and ready to use.

 

Tags

  • Debian
  • Apache
  • Configuration
  • Server
  • Linux

Language version switcher

  • English
  • Polish
RSS feed
Powered by Drupal