November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Keeping multiple web servers in sync with rsync

People looking to create a load balanced web server solution often ask, how can they keep their web servers in sync with each other? There are many ways to go about this: NFS, lsync, rsync, etc. This guide will discuss a technique using rsync that runs from a cron job every 10 minutes.

There […]

Disabling Mod_Security

1 Disabling Mod_Security Globally 2 Disabling Mod_security per domain 3 Disabling Mod_security per domain for an IP address 4 Disable Mod_security on a global URL 5 Disable Mod_security for an IP address 6 Whitelist an IP 7 Disable a rule for a single domain 8 Disable Mod_security rule for a specific application in a […]

Apache Minimal to Learn

APACHE :-

Apache is an open source web server which guarantees availability of active websites online . The original version of apache was especially designed for unix-like operating system Nowadays, it can be implemented on variety of O.S. platforms. According to Apache Software Foundation and Net craft web server survey, 65% of websites on the […]

htaccess-examples

I was testing authentication against Active Directory (LDAP) using Apache 2. The following worked for me in a .htaccess file but only after adding:

LDAPVerifyServerCert Off

in the main httpd.conf file. I presume this is related to the server name in the SSL certificate on the Active Directory server.

AuthBasicProvider ldap AuthzLDAPAuthoritative Off […]

SSL CERT EXPIRE certwatch

Certwatch checks for Apache certificates which are due to expire. By default on Red Hat / Centos there is a cron job in /etc/cron.daily which runs and sends its output to root. To configure it:

vi /etc/sysconfig/httpd

Add a line such as:

CERTWATCH_OPTS=”–period 30 –address test@rmohan.com”

It is also possible to switch it […]

Apache Httpd Server root privileges other than permission to start

Error message

Will output the following message when you run with the privileges other than root privileges when starting Apache HTTPD Server. 1 Permission denied: make_sock: could not bind to address 0.0.0.0:80

Cause

Smaller than the 1024 port enables the user to access only the root level of the port. Resolution […]

Apache force use https

Force Apache to use https :

RequestHeader set X_FORWARDED_PROTO ‘https’

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 […]

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>

[…]