• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Sunday, June 15, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to set up a web server on Debian using Apache

in Debian, Linux OS
How to set up a web server on Debian using Apache

How to set up a web server on Debian using Apache is a straightforward process. Follow the steps below to get started:

  1. Update your system

Before installing any new packages, it is always a good idea to update your system. Open a terminal window and run the following command:

sudo apt-get update && sudo apt-get upgrade

This will ensure that your system is up-to-date and all security patches are installed.

  1. Install Apache

Once your system is updated, you can install Apache using the following command:

sudo apt-get install apache2

This will install Apache and all its dependencies.

  1. Configure Apache

After installing Apache, you can configure it to meet your needs. The main configuration file for Apache is located at /etc/apache2/apache2.conf. You can open this file using a text editor such as nano or vim:

sudo nano /etc/apache2/apache2.conf

Here, you can configure various settings such as the server name, port, and document root. Once you have made any changes, save the file and exit.

  1. Test Apache

After configuring Apache, you can test it by opening a web browser and navigating to your server’s IP address. You should see the Apache2 Ubuntu Default Page, indicating that Apache is running properly.

  1. Configure Firewall

By default, Debian comes with a firewall called ufw. You can allow incoming HTTP and HTTPS traffic using the following commands:

sudo ufw allow http
sudo ufw allow https
  1. Install PHP

If you plan to run dynamic websites, you will need to install PHP. You can install PHP using the following command:

sudo apt-get install php libapache2-mod-php php-mysql

This will install PHP and the necessary modules.

  1. Test PHP

Once PHP is installed, you can test it by creating a test PHP file in the document root directory:

sudo nano /var/www/html/info.php

Add the following code to the file:

<?php
phpinfo();
?>

Save the file and exit. Then, navigate to http://your-server-ip/info.php in your web browser. You should see a PHP info page, indicating that PHP is installed and working.

That’s it! You now have a working web server on Debian using Apache.

ShareTweet
Previous Post

How to secure your Debian system with firewall and AppArmor policies

Next Post

How to set up a web server on Debian using Nginx

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.