Username:
Password:
    Forgot your password?
Member Login

Sitellite Server Administration

Notes

Chat Loading chat status
  • Please subscribe to chat.
  • Older messages can be viewed in the chat archive.

Subscribe  |  The Lounge  |  Share Lesson

Chapter 3: Optimizing the Environment

Page:   1 2 >



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

Page:   1 2 >



Page:   < 1 2



Optimizing PHP

The best way to optimize PHP is to install a code-level cache, which doesn't affect the way PHP scripts function at all, but can improve the performance of PHP code by several hundred percent in many cases, by moving it to RAM instead of reading it from the server's hard drive for every page request.

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"
Then restart Apache and you should have APC cache installed and running.

Page:   < 1 2



Chapter 4: Security Considerations »