Use openssl for local web development

For Mac OS X (local dev built with homebrew)

Store the ssl cert somewhere:
brew install opensll
cd /usr/local/Cellar/nginx
sudo mkdir ssl
cd ssl

Create cert:
# Create a 2048 bit private key
# Change your -out filepath as needed
sudo openssl genrsa -out "example.local.key" 2048
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
 -keyout example.local.key \
 -out example.local.crt

NGINX example (zf2):
server {
 server_name dev.example.local;
 listen 443;
 root /www/dev.example.local/public;
 ssl on;
 ssl_certificate /usr/local/Cellar/nginx/1.6.2/ssl/local.crt;
 ssl_certificate_key /usr/local/Cellar/nginx/1.6.2/ssl/local.key; 

 the rest of your settings...

Make sure you domain is in hosts file (using TextMate from terminal):
sudo mate /etc/hosts

Host file changes: dev.example.local

Stop/Start NGINX:
sudo nginx -s stop
sudo nginx


301 Redirect Problem with WordPress

Stumbled on this fix for a redirect issue I was having with a friend’s WordPress site:

Add this: remove_filter('template_redirect', 'redirect_canonical'); to the functions.php within your Active Theme folder.

You can find the functions.php file in: \wp-content\themes\{Your-Active-Theme-Name}


Force www rewrite on nginx

downloadThe best thing for this I’ve found is to setup two server directives in nginx :

In Terminal: sudo mate path_to_nginx.conf (sudo mate /usr/local/etc/nginx/nginx.conf) – if you are on Mac and using TextMate (highly recommended by me, it’s a great editor)

server_name my_domain.local;
if ($host !~* ^www\.) {
rewrite ^(.*)$ http://www.$host$1 permanent; #rewrite to force www
server {
server_name www.my_domain.local;
listen 80;
root /usr/local/var/www/projects/www.my_domain.local;
index index.php; #the rest of your fpm config follows.... }

Mac Developers: Share screenshots automatically

At MacUpdate, I use a really slick tool to share screenshots when collaborating with our team.  The App is called ‘Cloud’ and you can get it on (

Once installed, make sure you have the option set to share screenshots automatically.  Once you have that setting confirmed, you can share a screenshot with the key commands, cmd+shift+4 then drag the pointer selection to the area you want a screenshot of and Cloud App (located up in your apps bar) will push out your screenshot to a shortened url and Growl will notify you when it’s ready; just click the Growl alert (or the Cloud App link in your apps bar) and the c/p the url to share.  There is also a sharing button once you visit the shortened url for sociables and what-not.