HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part V

This part is optional. The web server with PHP and MySQL is already running. Now, we are going to fine tune the Apache and PHP to make it running as faster as possible. The kernel can also be optimized too.

Apache

sudo apt-get install libapache2-mod-bw libapache2-mod-fastcgi

sudo a2enmod deflate
sudo /etc/init.d/apache2 force-reload

Edit the file /etc/apache2/conf.d/deflate.conf :
sudo nano /etc/apache2/conf.d/deflate.conf

<IfModule mod_deflate.c>
DeflateCompressionLevel 6
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/postscript
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
</IfModule>

Edit /etc/apache2/apache2.conf :
sudo nano /etc/apache2/apache2.conf

Then change the value as the following :
ServerSignature Off
ServerTokens Prod

Updated for Ubuntu 9.04 :
sudo nano /etc/apache2/conf.d/security

Then change the value as the following :
ServerSignature Off
ServerTokens Prod

Edit /etc/apache2/sites-available/default :
sudo nano /etc/apache2/sites-available/default

Then change the value as the following at /var/www section :
Options -Indexes FollowSymLinks

Restart your Apache server :
sudo /etc/init.d/apache2 restart

PHP
To accelerate PHP, you need Zend but I will show you how to use eAccelerator.

Download the eAccelerator :
wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xvf eaccelerator-0.9.5.3.tar.bz2

sudo apt-get install build-essential php5-dev

cd eaccelerator-0.9.5.3
phpize
./configure
make
sudo make install

sudo mkdir /tmp/eaccelerator
sudo chmod 0777 /tmp/eaccelerator

Add the following lines at the end of /etc/php5/apache2/php.ini :

extension="eaccelerator.so"
; shm_size default is 16, you may change to 64 or 128 depends on your RAM
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

Still at the php.ini file or enter the following command to go there.
sudo nano /etc/php5/apache2/php.ini

Locate Display_errors = On and change it to “Off”.
Display_errors = Off

Restart the Apache :
sudo /etc/init.d/apache2 restart

Kernel

Please refer to my blog “Performance-tunning” at https://samiux.wordpress.com/2008/06/12/performance-tunning/ for details.

Advertisements

2 Responses

  1. […] (2) NAS – Part I (3) NAS – Part II (4) NAS – Part III (5) NAS – Part IV (6) NAS – Part IV(a) (7) NAS – Part V (8) NAS – Part VI (9) IP-PBX (VoIP […]

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: