mrkeck Sharing the Love


mod_rewrite not working

.htaccess mod_rewrite will not work unless you have the apache2 config correct

2 things to look for:

  1. AllowOverride All for the webroot
  2. LoadModule rewrite_module modules/ is not commented out
Filed under: apache, htaccess, web No Comments

Windows 7 projectLocker Amazon EC2

Windows 7
ssh-keygen -t rsa -C "username in projectLocker"

Add public key to user in ProjectLocker

Then install SmartGit

Use SSH url from ProjectLocker
and location of private key from ssh-keygen

Use winSCP and EC2 Private Key to access server

copy projectLocker private key to /home/(user in this instance)/.ssh/

Enter passphrase

Go to EC2 using SSH and go to where you want to clone the repository
"git clone ."



Limit Web Server Access by IP using .htaccess

Create/Edit .htaccess file in the directory you want to protect. In my case, I am using it in the root of my site to protect all of it.

Add these lines:

#By default don't let anyone in unless I say so
Order Deny,Allow
Deny from all
#These folks are ok to come in
#Single WAN IP
Allow from
#Group of 8 IPs starting with the first one
Allow from
# /29 is CIDR notation

#Mix and match on one line
Allow from,,
Filed under: Uncategorized No Comments

Amazon S3 Upload Directory Including Itself Using PHP SDK

//Upload directory into s3 directory
//Ex. 2013/01/02/test.jpg
//$bucket = 'myBucket';
//$dirToUpload = '2013';
//$uploadDir = '2013';
//$client->uploadDirectory($dirToUpload, $bucket . '/' . $uploadDir);
//In S3 you have 2013/01/02/test.jpg
//If you didn't add the /directory to the bucket would get 01/02/test.jpg
$bucket = 'myBucket';
$dirToUpload = 'C:/someDir/localDir';
$uploadDir = 's3Dir';  //Could be the same as $dirToUpload but you can change name too
$response = $client->uploadDirectory($dirToUpload, $bucket . '/' . $uploadDir);
Filed under: Amazon, PHP, S3 No Comments