Introduction
The Apache HTTP server is one of the most used web server today. The great features that Apache HTTP includes media assistance, loadable modules and extensive integration with other popular applications.
In this tutorial, you will be introduced to the best way to set up an Apache internet web server on your own Ubuntu 16.04.
Prerequisites
For the prerequisites needed before this tutorial, you should have a normal, non-root user with sudo privileges installed on your server. Don’t forget to configure a standard firewall to block non-essential interfaces. When everything is ready to go, you can start accessing your non-root user.
Step 1: Installing Apache
Apache is accessible within Ubuntu’s default software repositories. This will be installed by using standard package management applications.
To start, we will need to update the local package index to bring the upstream changes. When this is completed, we can install the apache2 package:
After this step, apt-get will install Apache with everything it needs.
Step 2: Modifying the Firewall
After step 1 is completed, we must test Apache and change our firewall in order to allow outside access to the default web ports. Assuming that all directions were followed, you will need to have a UFW firewall configured to limit access to your server.
During the previous step, Apache files with UFW to provide a few application profiles. After confirming the setup, apt-get will set up Apache and all necessary dependencies.
We can point the UFW application profiles by inputting:
You should get this list of the application profiles:
There will be three profiles available for Apache:
- Apache: This profile opens only port 80 (normal, unencrypted web traffic)
- Apache Full: This profile opens both interfaces 80 (unencrypted and normal web traffic) and port 443 (TLS/SSL encrypted traffic)
- Apache Secure: This profile opens only port 443 (Transport Layer Security (TLS) / Secure Sockets Layer (SSL) encrypted traffic)
For this tutorial, we will enable incoming traffic to the Apache Full profile by inputting:
You can double-check by inputting:
You should see this HTTP traffic allowed:
After step 2, the profile is now on to allow access to the webserver.
Step 3: Checking the Web Server
After step 2, Ubuntu 16.04 begins Apache.
Everything should be up and working. We must double-check the system init system to make sure the service is running by inputting:
$ sudo systemctl status apache2
Afterwards, you will ask a webpage from Apache to completely check if all is working well. You can access this through your server’s domain name or IP address.
You will be able to get into the default Apache landing page to verify that everything is working well. Some may not want to set up a domain name, you can definitely use your server’s public IP address. In case you do not know your server’s IP address, here is a few ways to find it.
Start by inputting this at your server’s command prompt:
You will get back a few addresses separated by spaces. You can try every address in your browser to check if the addresses work. An option is inputting this, which ought to provide you with the public IP address as seen from a different location on the internet:
When you have your internet web server’s Internet Protocol (IP) address or domain, enter it into your web browser address bar:
Step 4: Managing the Apache Process
Here are the main management controls to get started with: Starting it after it has been stopped:
Stopping it:
Reloading without falling connections:
Disable automatic start when server boots:
Restarting it:
Re-enable the service to begin at boot:
When the server boots again, Apache should start by itself.
Step 5: Get Familiar with Important Apache Files and Directories
Now that you know how to handle everything, it is important to know these files and directories.
Content
Server Configuration
Server Logs
Conclusion
If all of these five steps were followed properly, the webserver is now installed correctly. You can now have the best experience with the content and technology you would like to apply.
If you have enjoyed this tutorial, make sure to check all the others on our website. If you have questions, please feel free to contact us and we will be more than happy to assist you.
Don’t forget to follow us on Twitter for news, updates, and announcements – @vexxhost.