APACHE

 Pasted Graphic 3.pict

APACHE


-resources:

 http://2bits.com/ (search apache)

 http://www.devside.net/articles/apache-performance-tuning



MaxClients - defines how many simultaneous requests can be served. Any connection requests from browsers that come in after that will be queued.  Default hard limit of 256.  Is ok to set high for static content, but bad for rendered pages.


MaxSpareServers

MinSpareServers

StartServers


ServerLimit


Thrashing - where the system is just swapping pages from physical memory to virtual memory (on disk), and vice versa, without doing any real work.


Apache processes with modules (mod_perl, mod_python, mod_php) can easily be 21MB per process.


Can improve with PHP op-code cache/accelerator, then you can make each Apache process take as little as 12MB.


-this is where one_liner for RSS

-sort processes by mem usage

# ps auwxx --sort rss

# icps "semiphores"


-if apache is high mem usage, check MaxRequestsPerChild and keepalives


------

REAL WORLD


# prefork MPM

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# ServerLimit: maximum value for MaxClients for the lifetime of the server

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule prefork.c>

StartServers 8

MinSpareServers 5

MaxSpareServers 20

ServerLimit 128

MaxClients 128

MaxRequestsPerChild 4000

</IfModule>




------

Rewrites


Rewrite to force HTTPS

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


Rewrite to force WWW.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^domain.com [NC]

RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] 



The following will redirect '.com' site to the SSL enabled '.co.uk' site; then force a rewrite of non-SSL requests to the '.co.uk' will be forced to the 'https' version of the site:


RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.pruhealthrewards\.com$ [NC]

RewriteRule ^(.*)$ https://www.pruhealthrewards.co.uk/$1 [R=301,L]

RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301]



--------


Apache Password Protect Directory

// .htaccess file

AuthType Basic

AuthUserFile /path/to/.htpasswd

AuthName "Restricted Access"

require valid-user


# htpasswd -c /path/to/.htpasswd username



<Directory /var/www>

Options Indexes Includes FollowSymLinks MultiViews

AllowOverride AuthConfig

Order allow,deny

Allow from all

</Directory>



----------


RewriteEngine On

RewriteCond %{HTTP_HOST} ^domain.net [NC]

RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] 









----------


Redirect using .htaccess file


By File:

Redirect /old/directory/oldFile.html http://domain.com/newdirectory/newfile.html


By Directory:

Redirect /oldDirectory/ http://domain.com/newDirectory


By Domain:

Redirect / http://domain.com/


----------


Adding a directory alias


add to httpd.conf:

Alias /phpma/ "/usr/share/phpMyAdmin-2.8.2/" 


Now, domain.com/phpma will go to phpMyAdmin directory.



-------


PHP STUFF


http://www.radinks.com/upload/config.php


http://us3.php.net/manual/en/ini.core.php  -  this document describe core php.ini directives


http://bugs.php.net/bug.php?id=28625   this describes limit in post_max_size to 2GB


; Maximum allowed size for uploaded files.

upload_max_filesize = 50M


; Maximum size of POST data that PHP will accept.

post_max_size = 50M



Add the below to your .htaccess file 

    * php_value upload_max_filesize 10M

    * php_value post_max_size 20M


----


disable TRACE and TRACK methods


http://publib.boulder.ibm.com/httpserv/ihsdiag/http_trace.html


transcendlinux.com






--------------------------

empulsegroup.com

page index