Skip to main content

Apache

Opcache with Drupal

Submitted by system on
OPcache is an opcode cache for PHP. It is bundled with PHP 5.5.0 and later. The following settings work really well with Drupal. For Ubunti 14.04 , these following file can be modified to incorporate the changes /etc/php5/apache2/php.ini
Configuration: opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Add www to URL using Apache mod_rewrite

Submitted by amitsedai on
For sites belonging to a domain name(Not Subdomain), one can access the site using the domain name with www, Ex: www.example.com or without it: example.com Both ways the site can be accessed when a ServerAlias is created in the config. However this is confusing as session information for both is different, which means if one is accessing the site with www preceded and logs in, on accessing the site without www preceded - the server would have no information saved. To redirect any domain name to use www by default, the following mod_rewrite condition can be used:

Disabling Munin and Awstats

Submitted by amitsedai on
Munin is a server and network monitoring tool. AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. Sometimes both can result in High Server i/o due to its periodic cron tasks. Uninstalling via command line wont help as you may see cron based tasks for Munin and Awstats running in logs.

Apache Benchmarking

Submitted by amitsedai on
Apache benchmarking is a tool used for benchmarking apache based websites. The syntax for anonymous users: ab -c no_of_concurrent_users -n no_of_requests_per_user URL To capture the benchmarking information for authenticated users, we need to capture the cookie information for any authenticated user from the browser and provide it in a name=pair cookie value in the command ab -c no_of_concurrent_users -n no_of_requests_per_user -C cookie_name=cookie_value URL The data we are interested in looking for benchmarking is:

Apache Tuning

Submitted by amitsedai on
Enable Mod Expires Drupal states via .htaccess that if mod_expires is on, it caches all files for 2 weeks. This means that the browser would cache static content. Set KeepAlive On For Apache to wait until all the elements of a page requests are provided. MaxKeepAliveRequests -> How many download requests per page.. [Check with Firebug] KeepAliveTimeOut 15 --> How many seconds required for the page to load completely in the browser. 4 sec is a good threshold.

Apache URL Redirection on VPS

Submitted by amitsedai on
I faced an issue with redirecting a particular URL to another URL at the Apache settings. You can write an index.php(php based solution) file for redirecting the header to the required URL. However, this didnt seem to me like an apt solution hence I looked for a solution at the Apache Config itself. Considering you have a VPS where you have configured the virtual host as follows: ServerName pr.example.com
ServerAlias pr.example.com
DocumentRoot /sites/www/pr.example.com/public_html/
ErrorLog /sites/www/pr.example.com/logs/error.log