According to the Apache software foundation that was established in 1999 based on individual donations and corporate sponsors, Apache is open-source software that runs on 67% of the world’s web servers.
Able to meet the needs of many with reliable security and incredible speed, Apache became the most extensively used web server around the world.
Additionally, Apache is used by the majority of WordPress hosting providers to freely turn computers into HTTP servers so people can request them as websites over the internet.
Also, it can provide other impressive features that include but are not limited to:
Side note: a web server is a software that receives your web page request, runs security checks on your HTTP request, and delivers you the web page as quickly as possible.
That speed depends on the modules your server has to run based on the page you requested.
Now that you’ve got everything ready, let’s jump right into it!
Updating your local software package database to the latest version is advised before installing additional software.
Not only it will shorten the future updates’ time, but will also protect your outdated software against any manipulations.
To update your local package index on Ubuntu, open your terminal and type in the following:
Give the package manager some time to finish updating.
You’ll have no problem installing Apache after the update since it’s already available as a part of Ubuntu’s default software depository, and can be installed using current package management tools.
This time, type in your terminal:
As seen in the screenshot above, the system will ask for your confirmation.
Just allow it to conclude the Apache installation.
Carried these simple steps but still unsure whether it worked? We got you covered!
Simply, open a web browser and type localhost in the address bar.
Once you receive (and you will) a page titled “Apache2 Ubuntu Default Page” like the one below:
It means that now Apache has been successfully installed on your server!
Another option to verify is to open your web browser and type in: http://local.server.IP “where IP is replaced with your server’s IP address.
Worried about how to figure out your server’s IP address?
Use freeware online tools like whatismyipaddress.com/ or type in your terminal: hostname -I | awk ‘{print $1}’
Seriously, localhost should do just fine.
You should have a UFW firewall ready, given that you followed the above instructions. Therefore, the only steps you need to take are:
Take a look at the available UFW’s app profiles by typing: sudo ufw app list using your terminal.
Apache: a profile that opens port 80
Apache secure: a profile that opens port 443
Apache full: a profile that opens both port 80 and port 44
We recommend enabling the port that will allow your configured traffic so far, which’s port 80.
To do that, type in the following command using your terminal:
Afterward, you can verify the change by typing:
Having control over your service is a must, especially in our case, where you’ll find yourself restarting and/or reloading Apache often.
With our up and running server, here are some basic options you can take advantage of when it comes to controlling, using the systemctl command.
To restart the service:
To stop your server:
To start after stopping:
Disabling Apache automatic start:
Re-enabling automatic startup:
Reloading Apache to make simple configuration changes:
Your system might ask to reload Apache at any given command, which’s completely fine.
You can use Apache virtual hosts to host more than one domain from a single server.
We will set up a domain called serverhubtest, but feel free to replace it with your own domain name.
Apache on Ubuntu 20.04 has one server block enabled, which’s configured to serve documents from the /var/www/html
directory.
Indeed, this works well for a single site, but it can become unmanageable if you’re hosting multiple sites.
Let’s create a directory structure within /var/www for a serverhubtest site, instead of modifying /var/www/html
Create the directory for serverhubtest by inputting:
Then, assign ownership of the directory:
Next, create a sample index.html page using the nano editor:
Afterward, add the following sample HTML:
<html> <head> <title>Welcome to
serverhubtest</title> </head> <body> <h1>It works! You amazing tech-savvy you!
</h1> </body> </html>
Save with CTRL + X then Y, and close the file when all is finished.
Now, you’ve to create a virtual host file with the correct directives, instead of modifying the default configuration file located at /etc/apache2/sites-available/000-default.conf
To do that, use your terminal to input:
Paste in the following configuration block that’s similar to the default, but only updated for the new directory and domain name:
<VirtualHost *:80>ServerAdmin webmaster@localhost
ServerName
serverhubtestServerAlias
www.serverhubtestDocumentRoot /var/www/
serverhubtestErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save using Ctrl + x and close the file.
It’s time to enable the file with the a2ensite tool:
Disable the default site in 000-default.conf
:
Finally, test for configuration errors using:
You should receive the following output:
OutputSyntax OK
Last note: restart Apache to implement your changes:
Apache should now be serving your domain name.
You can test this by visiting http://serverhubtest, or writing localhost in your browser address bar.
When you do see something like this:
It means that you’ve done it, you amazing tech-savvy you!
Congrats! You’ve definitely come a long way with managing the Apache service. Still, you need to take extra minutes to get used to a few important directories and files.
Log files for generated errors can be found at /var/log/apache2/error.log
Access logs for interactions with clients are in the file /var/log/apache2/access.log
The website content is stored in the /var/www/html/
directory
Apache does function through configuration files, which are located in /etc/apache2/
The main Apache configuration file that controls everything is located at /etc/apache2/apache2.conf
The file that holds ready-to-serve-client websites: /etc/apache2/sites-enabled
The storage for Apache virtual host files:
/etc/apache2/sites-available
You can customize the ports Apache monitors using the file: /etc/apache2/ports.conf
Feel free to take a deeper look at all other configurations and directories visiting the Ubuntu server guide.
You’re probably wondering: How can I create my complete website in the easiest way?
That’s where we’ve got you covered.
ServerHub provides top-of-the-line dedicated servers at affordable prices using only enterprise-grade hardware.
We constantly add new integrations and features to our products, so no matter what your website is for, ServerHub is here for you.
If you’re thinking of creating your own website, don’t hesitate to reach out to our support team for information at: support@serverhub.com
Although this article focuses mostly on Ubuntu Linux and how to install Apache, ServerHub can be used with any operating system.
Here’s a glimpse of what you’ll get when you deploy your server using ServerHub:
1. Multiple locations
Our Platform spans 9 locations around the globe that it seems like your servers are right next to each other.
We have multiple single 40GB interface connectivities within our data center to bring you the fastest connections available
2. A Simplified, Beautiful Interface
Elegance meets Simplicity. True brilliance and execution can only be expressed in one word: HubGrid.
Designed from the ground up with beauty, finesse, and pixel-perfect presentation. No other panel can compare.
3. 100% Uptime, 24/7 support, and leading resolution times!
We deliver fast, reliable, and knowledgeable support with every service we provide.
We focus on meaningful resolution times so you can get the answers you want when you need them. Because what is a great enterprise network and infrastructure without a solid team to support it?
4. Consider a Custom Quote
Need a Custom Quote? Our sales team at sales@serverhub.com can Help!
Get a custom solution backed by 24/7/365 support, and built on a solid redundant Tier 1 Network.
Naturally, you face these obstacles at first when you’re getting exposed to the web hosting and cloud deployment world.
Still, as you can see, there’re plenty of other options that you can choose from to run your own server.
Now it’s time for you to start running your own website.
Take advantage of ServerHub’s unlimited personalization, great customer support, and unprecedented prices starting from $5 a month!
What are you waiting for?
If you need help with your amazing upcoming website or have questions or suggestions, please reach our support team at: support@serverhub.com
I know this has been quite the tutorial, but you made it to the moment of truth!
After cheering up with the fact that you now have your web server installed, you still got many ways left to go!
If you’re thinking of something that’s right there at your fingertip, ServerHub can spare you all the technical details -plus many more-.
Instantly deploy your own server and website in a matter of no time!
What content are you planning to have? What are the best practices you’ll follow to enhance both your site and visitors’ experience?
Tell us in the comments below how will-you put your newly gained Apache configuration skills into good use!
This tutorial is a part of the LAMP stack guide series.
Check out the rest of the series:
How to install the latest Ubuntu Linux? Beginner’s guide
How to Install PHP on Ubuntu 20.04? Step-by-step Easy Guide
How To Install MySQL On Ubuntu? The Proven 2021 Guide
Read more
What Are The Types Of Operating Systems (OS)
What’s The Difference Between Remote VPN & Site-To-Site VPN
Introduction to Oracle Database Oracle Database is a widely adopted relational database management system (RDBMS)…
Introduction to MySQL MySQL is one of the most widely used open-source relational database management…
Deep learning is a type of artificial intelligence that teaches computers to learn from large…
OpenSSH or Open Secure Shell is a powerful suite of tools that provides secure remote…
Virtualization has become a cornerstone of modern IT infrastructure in today's digital era. Among the…
Welcome to ServerHub’s comprehensive guide on installing, setting up, and configuring your first Git server!…
This website uses cookies.