Apache Tutorials

Install LAMP on Ubuntu 12.04 (Linux, Apache, MySQL, PHP)

In this tutorial we will look at how to install Apache, MySQL, and PHP on an Ubuntu 12.04 system using the command line. This set of packages together is called a LAMP server or a LAMP stack. The LAMP stack is the most common form of software stack used on web servers today.

Apache is used to serve web pages, PHP works with Apache to enable you to create dynamic web pages, and MySQL works with PHP to enable it to communicate with a database backend. Note that any of these packages can be installed separately but for running a dynamic website, they are usually installed together.

Enable mod_rewrite on Ubuntu

It is very easy to enable mod_rewrite in Ubuntu as you will see in the tutorial below. The rewrite module (mod_rewrite) is used by the Apache web server to rewrite requests on the fly. By rewriting requests, we mean that the URL that is sent by the user is changed to something different internally before it is passed to the script which is processing the request.

Newer servers which run Ubuntu 10, Ubuntu 11 or Ubuntu 12 with Apache2 installed, can have mod_rewrite installed with a single command.

Linode Review 2012 (Xen VPS Hosting)

In this article, we will be doing a review of Linode, the Xen VPS hosting provider that Tutorial Arena has been using since December 2010. Here at Tutorial Arena, we are very satisfied with the level of service that we have gotten from Linode in the just over a year that we have been with them.

List all virtual hosts served by Apache2 on Ubuntu

By using virtual host configurations, it is possible for more than one website to be served by the same Apache web server on the same machine. Virtual hosting makes it easy to run multiple websites from the same server. You simply make a new virtual host configuration for each new website that you want to set up and then reload the Apache configuration.

PHP Memory Limit and htaccess

The PHP memory limit will need to changed sooner or later as we start writing and running more resource intensive scripts. The idea of a memory limit is important on a web server since the server may be serving many requests at a given time, and we wouldn't want any one request or script consuming too many resources. Also, it is useful to limit how much memory a script can consume in a setting (like a VPS) where resources like RAM are limited.

Count search engine referrals using web server logs and shell commands

Suppose you want to know how much of your website traffic comes from Google or another search engine. It's very easy if you use Awstats or Google analytics, but what if you haven't configured these tools? Using only the web server log files and some shell commands will enable us to quickly parse log files and give a count of how many referrals we had from a search engine.

For the purposes of this tutorial, we will be assuming an Apache web server, and that the search engine that we are counting the referrals from is Google.

Use htaccess to Block IP Address

In this tutorial we will show how to use an .htaccess file to block an IP address. This is one of several methods of blocking incoming requests to a web server. Other methods include blocking the IP address at the firewall or in PHP code, etc.

There are many reasons why you would want to block an IP address. It may be someone or something wasting or stealing your resources by making multiple requests to files on your server. It could be someone trying to spam your site. Whatever the reason for wanting to block an IP address, the htaccess file comes to the rescue.

Apache compiled in modules

Apache is a very well-designed and modular web server. Its power and convenience partly comes from its ability to use various modules, and the ease in which these modules can be changed as necessary. Specific modules can be compiled into the server when it is being built so that a web server suited for a particular task is ready out of the box.

Most times, we are not the ones who have compiled Apache so we have no way to immediately know what modules have been compiled into it. Coming to our rescue is a simple command we can execute to determine Apache's compiled modules.

Check Apache version on Ubuntu linux

To ensure that we have the latest version of the Apache web server running, we need to perform a check on our current version.

In the tutorial below, we will demonstrate how easy it is to check our Apache version on Ubuntu or other similar modern flavour of Linux.

To check what version of Apache we have running, we can open a terminal and execute the following command:

apache2 -v

Restart Apache2 Ubuntu

We need to restart our Apache2 web server when we want to load new configurations from the configuration files. Restarting the web server to load configuration files is necessary as these configuration files are only read each time when the web server is in the process starting.

Note that the Apache web server does not need to be restarted on every configuration change; sometimes a simple reload will do. In any case, restarting won't hurt.

To restart Apache2 on Ubuntu, we enter the following command in a terminal such as bash: