mrkeck Sharing the Love

24Jul/130

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/mod_rewrite.so is not commented out
Filed under: apache, htaccess, web No Comments
20Jul/130

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/

ssh git-YOURS@pl2.projectlocker.com
Enter passphrase

Go to EC2 using SSH and go to where you want to clone the repository
"git clone git-yourAccount@pl23.projectlocker.com:something.git ."

Done

18Jul/130

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 100.100.100.100
#Group of 8 IPs starting with the first one
Allow from 90.123.123.96/29
#90.123.123.96-90.123.123.103
# /29 is CIDR notation

#Mix and match on one line
Allow from 217.123.123.76, 63.92.123.21, 91.123.123.96/29
Filed under: Uncategorized No Comments
12Jul/130

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