Optimizing Server to make sites fast

Optimize/ Tune Server

Use fast web server software

  • Nginx
  • LiteSpeed
  • Lighttpd

Apache

Addons:

Ensure you have the latest version softwares, check using <?php phpinfo(); ?>

Enable GZip Compression.

User Worker MPM instead of Prefork.

Use XEN instead of OpenVZ

Use SSH through Putty to view resource usage:

top: current server load & resource usage.
ps aux: processes & one using the most memory.

Disable useless modules from Apache, Mysql and PHP

  • PHP: /etc/php.ini

Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 6

memory_limit = 64M

<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 4000
</IfModule>

  • Apache: /etc/httpd/conf/httpd.conf

expose_php = Off
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
post_max_size = 6M
file_uploads = On
upload_max_filesize = 6M

MaxClients=250

Timeout=30

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 1
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 1000

KeepAliveTimeout=3

  • MySQL: etc/mysql/my.cnf

query_cache_type = 1
query_cache_size = 20M

query-cache-limit=2M

skip-innodb

key_buffer=2M
max_connections=250

WHM/ Cpanel Settings

Service Configuration > Service Manager or Cpanel > Plugins

Disable: Clamd, Entropy Chat, Spamd

Server Configuration > Tweak Settings

  1. Default catch-all mail address is set to FAIL.
  2. Untick Mailman
  3. number of minutes between mail server queues = 180
  4. Uncheck Analog Stats.
  5. Tick delete each domains access logs after run.

Leave a comment

Your email address will not be published. Required fields are marked *