Setting Up SSL Certificates On PHP Fog Apps

Let me tell you, it was something of an endeavor setting up an SSL certificate on a PHP Fog application, mostly due to lack of (obvious) documentation, but their technical support was extremely fast and helpful, so we were able to get through the issues quickly. Here’s a little step-by-step write up for those of you who might still be in the dark about the whole SSL certificate installation process.

First of all, be ready to fork over $20 per month to enable the ability to attach an SSL certificate to your PHP Fog application. (C’mon guys, really? I get that IPs are limited, and Amazon’s ELB has a price too, but there’s got to be a better and more cost effective way to do this.)

Second, you’re going to want to log into a computer with OpenSSL installed, so that you can generate the private key to sign your Certificate Request (CSR) file. Run the following command to generate the private key, and be sure to not use a PEM passphrase:

openssl genrsa -out phpfog.key 2048

Now, we are going to generate the Certificate Request. Run the following command to generate the CSR file, using www.yourdomain.com or *.yourdomain.com for the “Common Name” input when it prompts you:

openssl req -new -key www.reconapi.com.key -out phpfog.csr

You can now use this .CSR file to generate your SSL certificate from your provider. I used a Comodo PositiveSSL certificate from NameCheap, which ran me a grand total of $8.95 … however they’re currently running a promotion offering PositiveSSL certificates for $1.99 with the registration or transfer of a domain name. (affiliate link)

Once you generate your SSL certificate with your .CSR file, your provider will make the certificate available for download via e-mail or their website. Be sure to download all related certificates, including the intermediary certificate if there is one available.

Now, navigate to your application’s dashboard on PHP Fog, and select the SSL tab from the sidebar. You are going to be filling out two (possibly three) text boxes with relevant certificate information:

  • Paste the contents of www_yourdomain_com.crt into the Signed Certificate text box.
  • Paste the contents of phpfog.key into the box labeled RSA or DSA Private Key Used to Sign the Certificate.
  • If you received an intermediary certificate, check the box “Use intermediate certificate” and paste the contents of the intermediary certificate file into the text box that appears.

You should be good to go, just click the orange ‘Enable SSL’ button to proceed! Remember, you will have to add some sort of redirection to your application, it won’t automatically forward your visitors to the proper secure pages. I tried using mod_rewrite, however %{HTTPS} does not seem to work, so here’s a little PHP snippet that works instead:

if($_SERVER['HTTP_X_FORWARDED_PROTO'] !== 'https') {
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"); exit;
}

Mount Box.net Storage As Network Drive

Box.net has been running a recent promotion giving away a FREE 50GB of cloud storage if you sign up for your account via one of their iOS applications. Naturally, this was very tempting. However, after signing up I realized there was no easy way to upload mass amounts of files. Well, a little Google magic and I had a solution to make the newly acquired 50GB “cloud drive” mount as a network drive and be available through Windows Explorer!

  • Mount Network Drive > Specify an alternate network location
  • Enter https://www.box.net/dav in the “Internet or network address” field
  • Once you click next, you will be prompted to enter your box.net credentials. After you enter your username and password and successfully log in, name your “Network Drive” and you’re good to go!

Reset the Root MySQL Password on Ubuntu 10.04

It’s a commonality among sleep-deprived developers to set up a sandbox at 3AM and wake up not remembering the passwords that were set before the retreat into la-la land. Well, resetting the root user’s administrative password for MySQL is a little tedious, but it’s not impossible:

  • sudo /etc/init.d/mysql stop
  • sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
    You will now be able to log into MySQL as root with no password, since you have launched the MySQL daemon with the flag to skip the privilege index.
  • mysql -u root
    • FLUSH PRIVILEGES;
    • SET PASSWORD FOR root@'localhost' = PASSWORD('password');
    • UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
    • FLUSH PRIVILEGES;
  • sudo /etc/init.d/mysql stop
  • sudo /etc/init.d/mysql start

Installing Git on Ubuntu 10.04

I’m positive there are other blog posts almost identical to this one, however since this blog serves for the purpose of posterity, I am going to post it as a reference regardless.

In order to install Git (via command line) on Ubuntu 10.04, Lucid Lync, you must follow these steps:

  • sudo aptitude build-dep git-core
  • wget http://git-core.googlecode.com/files/git-1.7.7.tar.gz
  • tar xvzf git-1.7.7.tar.gz
  • cd git-1.7.7
  • ./configure
  • make
  • sudo make install
  • git --version

Pandora via the Command Line on Ubuntu 10.04

I’ve been using a really great command line app to listen to Pandora on my laptop lately, it’s called Pianobar. You can install it by running the following commands:

cd ~
sudo apt-get install build-essential
sudo apt-get install libao-dev libmad0-dev libfaad-dev
wget https://github.com/PromyLOPh/pianobar/tarball/master
tar xvf Promy*.tar.gz
cd Promy*
make
sudo make install

That’s it! You’ve installed Pianobar on Ubuntu 10.04, Lucid Lynx. Now just run pianobar to start the Pandora CLI app. Please refer to man pianobar for further usage instructions

Windows Vista/7 God Mode Shortcut

You’ve probably heard of this little easter egg before, but in case you haven’t, Microsoft offers a myriad of various administration tools that are only available in a hidden Easter Egg shortcut, the GodMode shortcut!

It’s pretty easy to get access to Windows God Mode, here’s how:

  • Create a new folder where you would like your God Mode folder to reside.
  • Rename the newly created folder to: GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
  • Your folder will change to a “Control Panel” looking icon, and its name will set to GodMode. You’re done!

When you open the GodMode folder, you’ll be presented with a host of options, which all are a pretty granular version of your existing Windows Control Panel; however, there are new options to play with, and I’ll leave the discovery of those as an excercise for the reader.

DOM Monster JavaScript Performance Utility

DOM Monster

DOM Monster is a neat little JavaScript performance testing library (cross-browser, cross-platform) that was envisioned by Amy Hoy and coded by Thomas Fuchs. When there are problems, DOM Monster will point them out to you, and even try to suggest a fix!

Drag the (DOM Monster!) to your bookmarks bar, or visit the DOM Monster website for more informaiton.

Installing MacPorts From Command Line

Well, installing MacPorts is tedious itself, and can be especially annoying to manage when you have to do it on (several) remote systems. Here’s how you can perform the meticulous task completely from the command line:

  • Log in via SSH, or if you’re doing it from the system itself, open Terminal.
  • Download MacPorts from their SVN repository using cURL:
    curl -O http://svn.macports.org/repository/macports/downloads/MacPorts-1.7.1/MacPorts-1.7.1-10.5-Leopard.dmg
  • Mount the MacPorts disk image (dmg) using hdiutil:
    hdiutil attach MacPorts-1.7.1-10.5-Leopard.dmg
  • Run the MacPorts installer from the mounted MacPorts dmg:
    sudo installer -verbose -pkg /Volumes/MacPorts-1.7.1/MacPorts-1.7.1.pkg -target /
  • Update the MacPorts installation with the following command:
    sudo port -v selfupdate

Note:
You can unmount the MacPorts disk image (dmg) by running the mount command by itself to retrieve the disk ID, then running the command: hdiutil detach -verbose /dev/disk[ID]

Remove Amazon & Blockbuster Apps (Android)

You’ve probably never used either of the Amazon MP3 or Blockbuster mobile applications for Android, and you’ve also tried to uninstall them multiple times, and failed. Well, if you’ve rooted your Android phone, you can install an application called Titanium Backup (Free) that will allow you to uninstall ANY application on your phone, which includes the bloatware applications Amazon MP3 and Blockbuster, as well as applications that might not have a visible icon. Be careful when deleting things, as you could delete required system applications and files!

Instructions

  • Launch Titanium Backup and grant it root (Super User) access
  • Click on the Backup/Restore tab
  • Scroll to the unwanted application and select it
  • Choose the red “Un-install !” button and confirm your action
Titanium Backup - Remove BloatwareTitanium Backup - Remove Bloatware

Remove a Network Device From Boot Sequence

I get really annoyed when I’m forced to start at a hanging boot message, even more so when it’s preventable and/or avoidable. Namely, the prompt the wireless card in my development box is causing to hang. Even though I never use my wireless network, this just started happening the other day.

Anyways, disabling the device from activating during the boot sequence was the first thing that popped into my head, and now I don’t sit and watch the Great March of Loading Dots while my computer boots. It’s a simple configuration file edit, and you’re good to go.

/etc/sysconfig/network-scripts/ifcfg-wlan0 (change)
ONBOOT=yes
TO
ONBOOT=no

Note: If you want to disable another networking device besides wlan0, you can look for the appropriate configuration file to edit, just ls and peek at the contents of /etc/sysconfig/network-scripts