September 2012
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

Categories

September 2012
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

Apache Rewrite Cheat Sheet

Regular Expression Syntax ^ Start of string $ End of string . Any single character (a|b) a or b (…) Group section [abc] Item in range (a or b or c) [^abc] Not in range (not a or b or c) a? Zero or one of a a* Zero or more of a a+ One […]

Free Softwares

Office OpenOffice – office suite PC Suite 602 – office suite AbiWord – text editor Atlantis Nova – text editor Microsoft PowerPoint Viewer – power point files viewer Adobe Reader – pdf reader Foxit PDF Reader – pdf reader PDFCreator – create pdf documents Doc Convertor – document convertor Convert – unit convertor Converber […]

Apache rewrite rules

<Directory /var/www/vhosts/rmohan.com/httpdocs> RewriteEngine on rewriterule ^(.+).htm$ /$1.php [r=301,nc] RewriteRule ^community community.php [nc] ErrorDocument 404 /index.php </Directory>

Rewrite only if a folder exists

RewriteCondthat checks if the requested file exists:

RewriteCond %{REQUEST_FILENAME} !-f

Great, but that’s not what I was looking for. Instead I needed to Rewrite only if a specific folder existed. The solution turns out to be this:

RewriteCond %{DOCUMENT_ROOT}/path/within/your/project/ -d

You need DOCUMENT_ROOT as the RewriteCond -d checks for the full path

 

<IfModule mod_rewrite.c>

[…]

Apache: No listening sockets available, shutting down

One of the advantages of maintaing a popular project like XAMPP is the immense amount of community feedback you get. In other words: your inbox is a daily challenge. PHP 5.3 incompatibilities are hot topics these days. Here’s an Apache related one which hits my inbox on a very regular basis.

Variant 1

Apache complains […]

Installing Apache HTTP Server with a Quick-Start Config

The Apache HTTP Server has been the most popular web server on the Internet since April 1996 and is one of the most widely used open source software packages. In fact, the latest Netcraft Web Server Survey reports that more than half of all active web sites use Apache, making it more widely used than […]

Truncate a File to Zero byte in Linux

Sometimes you need to truncate/empty a file to zero byte length. For example, you have a big file that contains various logs and the size is too big to open it easily. Of course, you can remove this file and touch it again. But this way you will have to play with permissions and file […]

Log Rotation Apache

I have installed apache 2.2 on RHEL 5.7. It is working over ssl connection. I want to use rotatelog feature provided by apache. My httpd.conf file for specifying logs location is as below :

ErrorLog “|/apps/apache/bin/rotatelogs /mnt/nfs4/logs/apache/error_log.%Y-%m-%d 10M” <IfModule log_config_module> LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”” combined LogFormat “%h %l %u […]

Remove comments and blank lines from configuration files using grep

grep -v ‘^#’ /etc/httpd/conf/httpd.conf | grep -v ‘^$’

Redirect to the file

grep -v ‘^#’ /etc/httpd/conf/httpd.conf | grep -v ‘^$’ > test

 

 

 

Apache prefork tuning.

Modular structure of apache is one of the reason for its global dominance among webservers.We have the flexibility to adding or droping modules.Before we deal with apache prefork MPM we need to have a basic idea about apache Multi Processing Modules,Multi processing Modules (MPM) are the multiple request (hundreds to kilos) handling ‘department’ of apache.We […]