×

Configure Apache Virtual Hosts on Debian 9 - Step by Step Process ?

This article covers how to Configure up Apache Virtual Hosts on a Debian 10 server. Using Apache Virtual Hosts you can host multiple domains on a single server. 

Apache will break its functionality and components into individual units so you can customize independently. The basic unit that describes an individual site or domain is called a virtual host.


How to configure Apache Virtual Hosts on Debian ?

Apache is a free and open source web server used web server in the world, and it is commonly used in Linux servers.

To install Apache:

1. Check whether apache is already installed and running on your server. You can do this with the following command:

$ dpkg -l apache2

2. If apache is not installed, you can do this by running the following commands. First, make sure that the system repositories are up to date:

$ apt-get update

3. To install the Apache web server, execute the following:

$ apt-get install apache2

4. After the installation is complete, you should enable Apache to start automatically upon server reboot with:

$ systemctl enable apache2

5. You can also check the status of your Apache service with the following command:

$ systemctl status apache2

If you want to secure your website with an SSL certificate, you can generate and Install a free Letsencrypt SSL certificate.


Secure Apache with Let's Encrypt on Debian 9 - Step by Step Process ?

This article covers how to use certbot client of Let’s Encrypt to obtain SSL certificate for you domain.

To set these up DNS records for your server, you can follow these instructions for adding domains and then these instructions for creating DNS records:

  • An A record with your_domain pointing to your server’s public IP address.
  • An A record with www.your_domain pointing to your server’s public IP address.


To install Certbot as a snap on Debian

You must first have snapd installed on your server. 

snapd is a daemon required to install, use, and manage snaps. 

Installing the snapd package will also install the snap command on your server.

1. To install snapd, update your local package index if you've not done so recently:

$ sudo apt update

2. Then install the snapd package:

$ sudo apt install snapd

After running this command, you'll be prompted to confirm that you want to install snapd and its dependencies.

Do so by pressing Y and then ENTER.

3. Next, use the snap command to install the core snap. This will install some dependencies on your server that are needed for any snap you install, including the Certbot snap:

$ sudo snap install core

4. Then refresh the core snap. Doing so will ensure that you have the latest versions of snapd and its dependencies installed:

$ sudo snap refresh core

Following that, you can install the certbot snap with the following command.

5. Because Certbot must be allowed to edit certain configuration files in order to correctly set up certificates, this command includes the --classic option. This confinement level allows any snaps installed under it the same access to system resources as traditional packages:

$ sudo snap install --classic certbot

6. Create a symbolic link to this file in the /usr/bin/ directory to ensure that you can run the certbot command anywhere on your system:

$ sudo ln -s /snap/bin/certbot /usr/bin/certbot


Install Apache on Debian 9 Server - Step by Step Process ?

This article covers how to install an Apache web server on your Debian 9 server. The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popular software.


How to Install Apache ?

1. Let's begin by updating the local package index to reflect the latest upstream changes:

$ sudo apt update

2. Then, install the apache2 package:

$ sudo apt install apache2

 After confirming the installation, apt will install Apache and all required dependencies.


The Apache profiles begin with WWW:

1. WWW: This profile opens only port 80 (normal, unencrypted web traffic).

2. WWW Cache: This profile opens only port 8080 (sometimes used for caching and web proxies).

3. WWW Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic).

4. WWW Secure: This profile opens only port 443 (TLS/SSL encrypted traffic).


How to Manage Apache Process ?

To stop your web server, type:

$ sudo systemctl stop apache2

To start the web server when it is stopped, type:

$ sudo systemctl start apache2

To stop and then start the service again, type:

$ sudo systemctl restart apache2

If you are simply making configuration changes, Apache can often reload without dropping connections. To do this, use this command:

$ sudo systemctl reload apache2

By default, Apache is configured to start automatically when the server boots. If this is not what you want, disable this behavior by typing:

$ sudo systemctl disable apache2

To re-enable the service to start up at boot, type:

$ sudo systemctl enable apache2

Apache should now start automatically when the server boots again.


Install and Configure Apache On Ubuntu 18.04 | 16.04 - Step by Step Process.

This article covers how to install an Apache web server on your Ubuntu 20.04 server.

Apache or Apache HTTP server is a free and open source web server, developed and maintained by the Apache Software Foundation.

Apache allows website developers to serve their content over the web. It serves as a delivery man by delivering files requested by users when they enter a domain name in their browser's address bar.


To Install Apache 2 on Ubuntu Linux:

1. You can download the latest version of a software by first updating the local package index of Ubuntu repositories. Open the Terminal and enter the following command in order to do so:

$ sudo apt update

2. Next, enter the following command as sudo in order to install Apache2 and its required dependencies:

$ sudo apt install apache2

You may be prompted with a y/n option to continue installation. Please enter Y, after which the installation procedure will begin.

3. When the installation is complete, you can check the version number and thus verify that Apache2 is indeed installed on your system by entering the following command:

$ apache2 -version


Apache Server Logs Location:

1. /var/log/apache2/access.log: By default, every request to your web server is recorded in this log file unless Apache is configured to do otherwise.

2. /var/log/apache2/error.log: By default, all errors are recorded in this file.

The LogLevel directive in the Apache configuration specifies how much detail the error logs will contain.


Install phpMyAdmin with Apache on Ubuntu 20.04 - Step by Step Process ?

This article covers how you can  seamlessly install phpMyAdmin on your Ubuntu Linux system.

Working with a database can sometimes be intimidating, but PhpMyAdmin can simplify tasks by providing a control panel to view or edit your MySQL or MariaDB database.

To Install phpMyAdmin on Ubuntu:
1. Update the apt package tool to ensure we are working with the latest and greatest.

$ apt update && upgrade

2. Install PhpMyAdmin and PHP extensions for managing non-ASCII string and necessary tools.

$ apt install phpmyadmin php-mbstring php-gettext

During this installation you’ll be asked for the web server selection, we will select Apache2 and select ENTER.
Here, you have the option for automatic setup or to create the database manually.
For us, we will do the automatic installation by pressing ENTER for yes.
3. At this setup, you'll be asked to set the PhpMyAdmin password.
Specifically for the PhpMyAdmin user, phpmyadmin,  you'll want to save this in a secure spot for later retrieval.
4. Enable PHP extension.

phpenmod mbstring

5. Restart the Apache service to recognize the changes made to the system.

# systemctl restart apache2


Install and Configure Apache Web Server with Virtual Host on Debian 10 - Do it now ?

This article covers how to perform installation and configuration of Apache web server on Debian 10.

Also, you will learn how to create virtual hosts on an Apache server and troubleshoot errors. These steps are almost the same for Ubuntu and LinuxMint distributions.

Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development, it quickly became the most popular HTTP client on the web.


On most systems if you installed Apache with a package manager, or it came preinstalled, the Apache configuration file is located in one of these locations: /etc/apache2/httpd. conf. /etc/apache2/apache2.


Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache:

1. Restart Apache 2 web server, enter: # /etc/init.d/apache2 restart. $ sudo /etc/init.d/apache2 restart.

2. To stop Apache 2 web server, enter: # /etc/init.d/apache2 stop.

3. To start Apache 2 web server, enter: # /etc/init.d/apache2 start.


To check running status of LAMP stack:

1. For Ubuntu: # service apache2 status.

2. For CentOS: # /etc/init.d/httpd status.

3. For Ubuntu: # service apache2 restart.

4. For CentOS: # /etc/init.d/httpd restart.

5. You can use mysqladmin command to find out whether mysql is running or not.



More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com






Keep In Touch