Linux Web Server Set Up
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.
Prerequisites
Before you begin this guide, you should have a regular, non-root user withsudo
privileges configured on your server. Additionally, you will need to configure a basic firewall to block non-essential ports.
When you have an account available, log in as your non-root user to begin.
Install Apache
Apache is available within Ubuntu's default software repositories, so we will install it using conventional package management tools. We will begin by updating the local package index to reflect the latest upstream changes.
After confirming the installation,apt-get
will install Apache and all required dependencies.
Check your Web Server
At the end of the installation process, Ubuntu 16.04 starts Apache. The web server should already be up and running.
We can check with thesystemd
init system to make sure the service is running by typing:
Output:
As you can see above, the service appears to have started successfully. However, the best way to test this is to actually request a page from Apache.
You can access the default Apache landing page to confirm that the software is running properly. You can access this through your server's domain name or IP address.
When you have your server's IP address or domain, enter it into your browser's address bar:
This page is simply included to show that Apache is working correctly. It also includes some basic information about important Apache files and directory locations
Manage the Apache Process
Now that you have your web server up and running, we can go over some basic management commands.
To stop your web server, you can type:
To start the web server when it is stopped, type:
To stop and then start the service again, type:
If you are simply making configuration changes, Apache can often reload without dropping connections. To do this, you can use this command:
Last updated
Was this helpful?