How to install CloudFlare’s Free SSL on Laravel

… when you’re too stingy to use a full paid for SSL ;) or during development of course …

Following instructions doesn’t quite work due to the infinite number of various setups available.

Digital Ocean, Forge, Nginx, Cloudflare free SSL, Laravel 5.1, Laravel Collective Forms

Scenario:

  • SSL is already running in Cloudflare for website. However, Laravel doesn’t know about the SSL, so is generating none secure absolute URLs for the form methods.  An unlogged error along the lines of method not allowed:

MethodNotAllowedHttpException in RouteCollection.php line …

Solution:

  • Create a Self Cert certificate on your server in /etc/nginx/ssl
  • Edit the site’s nginx file /etc/nginx/ssl to point to the cert
  • If using Lavavel Forge: Install Existing Cert; Add the key and cert. Get the contents for each file from /etc/nginx/ssl/
  • Cloudflare: Set the SSL to Flexible

References:

https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-nginx-for-ubuntu-14-04

http://www.selfsignedcertificate.com/

https://medium.com/@tabacitu/how-to-install-cloudflare-s-free-ssl-on-laravel-forge-e99522078bcd#.9o6h4sc5f

Leave a Reply