What is the proper way to ask a professor to be your PhD supervisor? I sent an e-mail to a professor that I did undergraduate research about 9-10 years ago wondering if he could write a letter of recommendation.  He replied saying that he didn't think he would have anything meaningful to say, which is completely understandable. I didn't really do any publication with the undergraduate research, but I did something that he called a sanity-check, which was work on a coding assignment on developing a Distributed File System using FUSE.  The idea was that if an undergrad can do it, then the grad students should be able to do it. 

He also asked if I submitted anything to him.  I sent a reply on two e-books I published.  One of the e-books was referenced in a Russian Defcon (I didn't write it in Russian).  I also sent him a link to my blog.  After that, I asked if he could be a Ph.D supervisor.  

I should have asked here before sending him the e-mail though.  I'm not really sure if this is the appropriate way to go about finding a Ph.D supervisor.
I don't think that your approach is not good. 
It is always preferred to be straight to the point with direct focus on your aims and how would they fit into your potential hosting lab vision and goals.

Always, Keep It Short and Simple (this is called KISS principle).

However,
Some suggestions to enhance your odds:

0- Set your objectives and your target areas.

1- Get prepared by identifying your potential advisor' research interests by visiting his web site and his lab activities to see if it's fit to your needs.

2- Make a balance sheet between your strengths and weaknesses.
Don't be shy to identify your weaknesses, because you shall be providing an improvement plan on how to address them.

3- Try to come up and suggest some research topic that sticks with your potential advisors research interests.

Like this, your advisor will be more than glad to offer his/her expertise and embrace your proposal.

I believe by doing the aforementioned steps, you show that you are already on your way to a PhD. Such thing would be visible to your potential advisor and would be certainly appreciated.

Good luck.