Advertisement
Guest User

Untitled

a guest
Jan 25th, 2012
5,018
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer.
  2.  
  3. I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc).
  4.  
  5.  
  6. # Install rvm (no sudo!)
  7. # ------------------------------------------------------
  8. bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
  9. source ~/.rvm/scripts/rvm
  10. rvm install ree-1.8.7-2010.02
  11. rvm ree --passenger
  12. sudo mkdir -p /opt && sudo chown -R $USER /opt
  13. passenger-install-nginx-module --auto --prefix=/opt/nginx/ --auto-download --extra-configure-flags=--with-http_ssl_module
  14.  
  15. ## Setup a self-signed SSL certificate
  16. curl http://www.selfsignedcertificate.com/download.php?file=28727991/www.example.com.key > /opt/nginx/conf/server.key
  17.  
  18. curl http://www.selfsignedcertificate.com/download.php?file=28727991/www.example.com.cert > /opt/nginx/conf/server.crt
  19.  
  20. ## Sanity check your passenger_root and passenger_ruby
  21. ## Define virtual hosts in /opt/nginx/config/nginx.conf
  22. ## eg:
  23.  
  24. http {
  25.  
  26. passenger_root /Users/levi/.rvm/gems/ree-1.8.7-2010.02/gems/passenger-2.2.15;
  27. passenger_ruby /Users/levi/.rvm/bin/passenger_ruby;
  28. passenger_pool_idle_time 3600; # keep apps alive
  29.  
  30. # foo.lvh.me (http)
  31. # ------------------------
  32. server {
  33. listen 80;
  34. server_name foo.lvh.me;
  35. root /Users/levi/projects/foo/public;
  36. passenger_enabled on;
  37. rails_env development;
  38. }
  39.  
  40. # foo.lvh.me (https)
  41. # ------------------------
  42. server {
  43. listen 443; ssl on;
  44. ssl_certificate /opt/nginx/conf/server.crt;
  45. ssl_certificate_key /opt/nginx/conf/server.key;
  46. server_name foo.lvh.me;
  47. root /Users/levi/projects/foo/public;
  48. passenger_enabled on;
  49. rails_env development;
  50. }
  51. }
  52.  
  53. # Start nginx
  54. # ------------------------------------------------------
  55. sudo /opt/nginx/sbin/nginx
  56.  
  57. # Stop nginx
  58. # ------------------------------------------------------
  59. sudo /opt/nginx/sbin/nginx -s stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement