How To Install Apache Web Server on Your Linux VPS

How to Install An Apache Web Server On A Linux VPS

The Apache Software Foundation is one of the most venerable open source software houses of the modern era, presiding over a multitude of projects which shape the internet as we know it. One of the most ubiquitous, and equally unappreciated, project is the Apache HTTP server. The Apache web server has been the workhorse of the internet since the mid 90’s, and continues to be one of the top web servers in use to this day. Additionally, use it for highly interactive, moderate user load web pages. As such, you will find it in every major Linux distros repository. So when discussing how to install Apache Web Server on a Linux VPS, the conversation is quite short.

Use it in conjunction with PHP and MySql to create a unified application server, commonly referred to as the LAMP Stack (Linux Apache MySql PHP). A turnkey LAMP stack is available on our platform. If that is all you need, skip the rest of this post and check it out! If you would like to continue reading, then let’s start talking about how to install Apache Web Server on your Linux VPS!

How to Install Apache on a Linux VPS:

How To Install Apache Web Server on Your Linux VPS
How To Install Apache Web Server on Your Linux VPS

The latest version will appear in every major distros repositories, which means installing Apache onto your Linux VPS is as easy as:


[sourcecode language=”plain”]sudo apt-get install apache2
sudo systemctl start apache2
sudo systemctl enable apache2[/sourcecode]


[sourcecode language=”plain”]sudo yum install -y httpd
sudo systemctl start httpd
sudo systemctl enable httpd[/sourcecode]

And that’s all there is to it! Finally, go to your server’s IP address in a browser and see the Apache test web page. Consequently, this will verify that the web server is installed and running.

By default, the web server will serve the

[sourcecode language=”plain”]/var/www/[/sourcecode]


Try this in terminal to create a basic web page:

[sourcecode language=”plain”] echo “Hello World” /var/www/index.html [/sourcecode]

Then refresh your browser page, and voila! You’ve just created a web page on the server! Additionally, you can deploy the web pages made in your favorite web design program. This is great for a quick-and-easy website.

Apache Web Server Configuration

Apache Web Server
Apache Web Server

Two of the greatest strengths of the Apache web server is its extensibility and ease of configuration. Most application servers and database backends have a module “plug in” for the apache web server. These modules then have their own configurations allowing you to tune the web server for its specific environment and application. The subject of tuning on it its own requires a lengthy discussion and a lot  of trial and error to get it right.

The primary configuration file can be found here:


[sourcecode language=”plain”]/etc/apache2/apache2.conf[/sourcecode]


[sourcecode language=”plain”]/etc/httpd/conf/httpd.conf[/sourcecode]

For Debian-based distros the main configuration file points to several other directories from which the web server will load in .conf files, which means there is not much to configure in that file specifically. You can enable modules by copying the module’s .conf and .load files from /etc/apache2/mods-available to the /etc/apache2/mods-enabled folders like so:

[sourcecode language=”plain”]sudo cp /etc/apache2/mods-available/status.conf /etc/apache2/mods-enabled/

sudo cp /etc/apache2/mods-available/status.load /etc/apache2/mods-enabled/[/sourcecode]

For RHEL-based distros almost all of the configuration will be done in the main configuration file. Enabling a module is as simple as uncommenting the appropriate “LoadModule” line in the relevant file located in the following directory.

[sourcecode language=”plain”]/etc/httpd/conf.modules.d/[/sourcecode]

Apache documentation has further information on modules:

Deploy a Self Hosted Apache Web Server

(Visited 283 times, 1 visits today)

Share this post with your friends

Share on facebook
Share on twitter
Share on linkedin