I'm using Laravel Homestead and it is working fine. Now I want to implement HTTPS on one of my sites.
I found that to achieve that you just need to add ssl: true
into Homestead.yaml and then run vagrant reload --provision.
I can see it working when I run above command which shows:
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Certificate: laravel-cashier.local
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Site: laravel-cashier.local
And in /etc/nginx/ssl
, I can see these 3 files are created:
-rw-r--r-- 1 root root 683 Jul 19 16:26 laravel-cashier.local.cnf
-rw-r--r-- 1 root root 1269 Jul 19 16:26 laravel-cashier.local.crt
-rw-r--r-- 1 root root 1704 Jul 19 16:26 laravel-cashier.local.key
But what next?
When I'm trying to run the site with https:
Do I need to do any other steps?
Note: I'm using latest Homestead version 2.1.0.
I have already seen many posts, but I think they are too old and doesn't provide exact steps to achieve the result:
https://laracasts.com/discuss/channels/tips/tip-how-to-enable-ssl-in-homestead-20
https://laracasts.com/discuss/channels/servers/homestead-ssl
I assume you are using Windows + Vagrant machine with Homestead.
In this case
laravel-cashier.local
is your web application.You need to copy the certificate inside Vagrant, in Nginx to external folder:
$ sudo cp /etc/nginx/ssl/laravel-cashier.local.crt ~/laravel-cashier/laravel-cashier.local.crt
In Windows environment you can install this certificate with double-click and select the next specific storage:
Restart your browser. Done.
More info about how to add certificate: https://technet.microsoft.com/en-us/library/cc754841(v=ws.11).aspx#BKMK_addlocal
NOTE: This is valid for specific browser: Google Chrome
It is as I first suspected and mentioned in my comment. You SSL config seems correct since it reports the connection is secure. You are using a self signed certificate, which is fine for development, but it not signed by a recognized Certificate Authority and therefore the browser will not trust it. However once you deploy your project to the general public you will want to purchase a certificate from a recognized Certificate Authority. Once you have that certificate then this error will go away.
This is only a year old question but it feels like it is really old one.
Fist - with a version 6.1.0 of 'laravel/homestead" vagrant box you don't need any
ssl: true
, it is active by default, however your browser would not know if it can trust the ssl certificate anyway.The browser trust is a different issue to laravel and homestead, please see this answer to solve it.
Homestead works correctly, but self signed certificates no longer valid as of Chrome 58. You should manually install root certificate in Chrome for each site. Example: link