Sitellite Server Administration
Chapter 3: Optimizing the Environment
There are many ways you can optimize your server setup, depending largely on the traffic level of your website, and the types of services being offered. These range from caching solutions to load balancing and clustering database servers to offsetting files onto services like Amazon S3.
There are also tools like the YSlow Firefox extension which can help optimize your website load time. There's a lot you could write about each of these tools and techniques, which are outside of the scope of this lesson. Here we'll simply cover a few common ways of improving the server environment itself to make Sitellite work as efficiently as possible.
Optimizing the Apache Web Server
Several popular ways of improving Apache's performance include:
- Eliminating unused Apache modules, which reduces the amount of stuff loaded into the web server.
- Some people recommend recompiling Apache with the modules loaded statically instead of dynamically, however this has certain drawbacks to it as well.
- Turning .htaccess off and putting any .htaccess directives directly into the main Apache configuration file(s).
- Compiling Apache with architecture specific optimizations at compile-time.
- Optimizing the number of starting processes and the min/max processes based on how much traffic your web site sees.
- Reducing the KeepAlive time of dynamic scripts can also help.
Generally, inlining .htaccess options is probably the easiest of these to do, and can yield a noticeable performance boost as well. To do this, simply create a new <Directory> block for each .htaccess file, for example:
<Directory /PATH/TO/SITELLITE> <Files index> ForceType application/x-httpd-php </Files> <Files sitellite> ForceType application/x-httpd-php </Files> DirectoryIndex index index.html index.php AddType text/html .tpl php_flag short_open_tag off </Directory> <Directory /PATH/TO/SITELLITE/inc/data> Order allow,deny deny from all </Directory>
The actual contents of the inlined contents will depend on the actual contents of each .htaccess file, for example the mod_rewrite parts in the global .htaccess file in Sitellite's document root.
To find a list of all .htaccess files in Sitellite, so you don't accidentally miss one, you can use the following command:
cd /PATH/TO/SITELLITE find . -name .htaccess -print
Optimizing PHP
The easiest code caching extension to install is probably APC, the Alternative PHP Cache. First, make sure the directory "/usr/local/lib/php/extensions/no-debug-non-zts-20020429" exists. Sometimes the last two folders are missing. This is where extension .so (shared object) files are stored. Then, from the command-line, log in as root or superuser and enter:
pecl install apc
This should do the rest for you except for one last step. In your php.ini file (check the output of the phpinfo() function to see where this is located on your system), add the following line just under the [PHP] block header:
extension="apc.so"
Optimizing MySQL
I won't go into detail on the many ways you can optimize a MySQL database installation. Instead, here are a few good starting points:




John Luxford