You may have heard of a LAMP or a LEMP stack when referencing a web server configuration, and wondered what the differences are between the two. The difference is just in the web server software used. With a LAMP stack the web server used is Apache, whereas with a LEMP stack environment the web server used is Nginx (Engine X).
Both web servers operate differently, and require different configurations to set them up. Your requirements on which one to use will depend on the software you wish to run on the server.
Apache can handle .htaccess files, where as with Nginx this needs to be done in the configuration file.
Apache is more common (especially in a shared hosting environment), however can cause heavy ram usage if not configured correctly on cloud servers.
A default installation of PHP and Apache on a Ubuntu 13.04 will set a maximum upload limit of 2MB. Quite often you will want to increase this to a larger size. How high you set this limit will depend on your requirements.
This howto guide will step you through the process to increase the PHP upload limit.
Continue Reading…
By default, Ubuntu 13.04 doesn’t enable the rewrite engine module after installing Apache. The rewrite engine for Apache allows for on-the-fly URL rewriting/changing. This allows for the use of urls that are human readable, and SEO friendly. The rewrite engine is capable of capturing a website request, running it through a series of expression checks, and if a match is found, it will pass on the rewritten request to the web server. The end user would not notice anything different within their web browser, other than perhaps easier to read urls. The rewrite engine is great for re-directions, and is a requirement for some CMS packages such as Drupal.
This guide assumes that Apache is already installed on your machine. If it not installed, please install it first using the command “sudo apt-get install apache2”
Follow the steps below to enable the rewrite engine.
Enable the rewrite module using the command “sudo a2enmod rewrite”
Depending on which website you want the rewrite engine to work on, you may need to modify the Apache configuration files some more.
For the default website, open up the “/etc/apache2/sites-available/default” file in your favorite editor. I am using “nano” for this example
The file should look something like the image below. The lines you will need to focus on are the ones that start with “AllowOverride”.
You need to change the “AllowOverride None” to be “AllowOverride All” for the directories you want the rewrite engine to work in. There are other options that can be used for the AllowOverride feature, but I won’t be going into the details of those in this article.
Exit the editor, and Save the file.
Restart Apache using “sudo /etc/init.d/apache2 restart”
If Apache hasn’t been configured for a ServerName option yet, you may get the above error message, or something similar. This isn’t a huge concern, and can be resolved later.
You should now be able to create .htaccess files, and use them how you want.
A default installation of PHP and Apache on a Ubuntu 12.04 will set a maximum upload limit of 2MB. Quite often you will want to increase this to a larger size. How high you set this limit will depend on your requirements.
This howto guide will step you through the process to increase the PHP upload limit.
Continue Reading…
Ever wanted to run your own usenet search engine? This howto will go through the steps required to install the Newznab usenet indexer on Ubuntu. Ubuntu 12.04 was used for this guide, however all current versions of Ubuntu should be the same.
Continue Reading…
By default, Ubuntu 12.04 doesn’t enable the rewrite engine module after installing Apache. The rewrite engine for Apache allows for on-the-fly URL rewriting/changing. This allows for the use of urls that are human readable, and SEO friendly. The rewrite engine is capable of capturing a website request, running it through a series of expression checks, and if a match is found, it will pass on the rewritten request to the web server. The end user would not notice anything different within their web browser, other than perhaps easier to read urls. The rewrite engine is great for re-directions, and is a requirement for some CMS packages such as Drupal.
This guide assumes that Apache is already installed on your machine. If it not installed, please install it first using the command “sudo apt-get install apache2”
Follow the steps below to enable the rewrite engine.
Enable the rewrite module using the command “sudo a2enmod rewrite”
Depending on which website you want the rewrite engine to work on, you may need to modify the Apache configuration files some more.
For the default website, open up the “/etc/apache2/sites-available/default” file in your favorite editor. I am using “nano” for this example
The file should look something like the image below. The lines you will need to focus on are the ones that start with “AllowOverride”.
You need to change the “AllowOverride None” to be “AllowOverride All” for the directories you want the rewrite engine to work in. There are other options that can be used for the AllowOverride feature, but I won’t be going into the details of those in this article.
Exit the editor, and Save the file.
Restart Apache using “sudo /etc/init.d/apache2 restart”
If Apache hasn’t been configured for a ServerName option yet, you may get the above error message, or something similar. This isn’t a huge concern, and can be resolved later.
You should now be able to create .htaccess files, and use them how you want.
This howto article shows you how to add a new user and password combination to a .htaccess file, for use with the Apache web server. This assumes the Apache tools are installed (specifically the ‘htpasswd’ utility).
Continue Reading…
The “ApacheTop” package has been written to allow users to monitor real time statistics based on the Apache log files. ApacheTop is a great way to keep an eye on your Apache web server statistics. It allows you to monitor how many requests you get (total and per second), bandwidth usage (total and per second), the number of 2xx, 3xx, 4xx, and 5xx HTTP return code responses, individual page/url requests, and more.
ApacheTop is similar in style to the ‘top’ program for monitoring running processes, and also the ‘ntop’ program for monitoring network traffic. The application loads, and sits there constantly updating, and waiting for commands from the user.
Installing ApacheTop:
For Ubuntu or Debian:
$ sudo apt-get -y install apachetop
For CentOS or RedHat Enterprise Linux:
# yum install gcc gcc-c++ ncurses-devel readline-devel make wget # wget "http://www.webta.org/apachetop/apachetop-0.12.6.tar.gz" # tar xzvf apachetop-0.12.6.tar.gz # cd apachetop-0.12.6 # ./configure # make # make install
For other distributions, you can download the source files from http://www.webta.org/projects/apachetop/.
Running ApacheTop:
apachetop -f /path/to/apache/access.log
(Note: if you dont have read access to the log file, you may need to run apachetop as root, by prefixing the ‘apachetop’ command with the ‘sudo’ command)
Eg:
sudo apachetop -f /path/to/apache/access.log
Example output:
last hit: 15:06:23 atop runtime: 0 days, 00:05:35 15:06:33 All: 26 reqs ( 0.1/sec) 206.9K ( 685.6B/sec) 8148.6B/req 2xx: 25 (96.2%) 3xx: 0 ( 0.0%) 4xx: 1 ( 3.8%) 5xx: 0 ( 0.0%) R (335s): 26 reqs ( 0.1/sec) 206.9K ( 632.4B/sec) 8148.6B/req 2xx: 25 (96.2%) 3xx: 0 ( 0.0%) 4xx: 1 ( 3.8%) 5xx: 0 ( 0.0%) REQS REQ/S KB KB/S URL 1 0.03 16.5 0.6 / 1 0.07 8.2 0.6 /images/021.png 1 0.07 1.3 0.1 /images/011.png 1 0.07 4.8 0.3 /images/06.png 1 0.07 4.0 0.3 /images/031.png 1 0.07 5.0 0.4 /images/07.png 1 0.07 4.3 0.3 /images/08.png 1 0.07 4.4 0.3 /images/09.png 1 0.07 3.9 0.3 /images/10.png 1 0.07 3.6 0.3 /images/11.png 1 0.07 3.4 0.2 /images/12.png 1 0.07 3.5 0.2 /images/13.png 1 0.08 4.6 0.4 /images/14.png 1 0.08 2.7 0.2 /images/15.png 1 0.08 24.3 1.9 /images/041.png 1 0.08 6.0 0.5 /images/051.png
You can specify a number of options when running apachetop, and these can be see by reading the man page, or by running apachetop with the –help parameter:
Eg:
apachetop --help
The two options that I find the most useful are the -H and the -T options:
-H hits remember stats for this many hits -T secs remember stats for this many seconds
By default ApacheTop remembers stats for 30 seconds. 600 is a good figure to use (10 minutes) for the -T option.
Note: I had issues with apachetop running on Ubuntu where the hot keys wouldn’t get picked up, and to exit I had to press ctrl-c. If you know why this occurs, or know how to fix it, please add a comment below.
By default, Ubuntu 10.04 doesn’t enable the rewrite engine module after installing Apache. The rewrite engine for Apache allows for on-the-fly URL rewriting/changing. This allows for the use of urls that are human readable, and SEO friendly. The rewrite engine is capable of capturing a website request, running it through a series of expression checks, and if a match is found, it will pass on the rewritten request to the web server. The end user would not notice anything different within their web browser, other than perhaps easier to read urls. The rewrite engine is great for re-directions, and is a requirement for some CMS packages such as Drupal.
This guide assumes that Apache is already installed on your machine. If it not installed, please install it first using the command “sudo apt-get install apache2”
Follow the steps below to enable the rewrite engine.
Enable the rewrite module using the command “sudo a2enmod rewrite”
Depending on which website you want the rewrite engine to work on, you may need to modify the Apache configuration files some more.
For the default website, open up the “/etc/apache2/sites-avaliable/default” file in your favorite editor. I am using “nano” for this example
The file should look something like the image below. The lines you will need to focus on are the ones that start with “AllowOverride”.
You need to change the “AllowOverride None” to be “AllowOverride All” for the directories you want the rewrite engine to work in. There are other options that can be used for the AllowOverride feature, but I won’t be going into the details of those in this article.
Exit the editor, and Save the file.
Restart Apache using “sudo /etc/init.d/apache2 restart”
If Apache hasn’t been configured for a ServerName option yet, you may get the above error message, or something similar. This isn’t a huge concern, and can be resolved later.
You should now be able to create .htaccess files, and use them how you want.