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:
The latest version will appear in every major distros repositories, which means installing Apache onto your Linux VPS is as easy as:
sudo apt-get install apache2 sudo systemctl start apache2 sudo systemctl enable apache2
sudo yum install -y httpd sudo systemctl start httpd sudo systemctl enable httpd
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
Try this in terminal to create a basic web page:
echo “Hello World” /var/www/index.html
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
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:
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:
sudo cp /etc/apache2/mods-available/status.conf /etc/apache2/mods-enabled/ sudo cp /etc/apache2/mods-available/status.load /etc/apache2/mods-enabled/
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.
Apache documentation has further information on modules: