Use SSL on Laravel Homestead

I use Laravel Homestead and it works fine. Now I want to implement HTTPS on one of my sites.

I found that for this you just need to add ssl: true to Homestead.yaml and then run vagrant reload --provision.

I see that it works when I run a command that 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 see that 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's next?

When I try to start a site using https:

enter image description here

enter image description here

enter image description here

Do I need to take any other steps?

Note. I am using the latest version of Homestead version 2.1.0.

I have already seen many posts, but I think they are too old and do not provide the 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

Laravel Homestead - SSL Setting

+3
source share
3 answers

I assume that you are using a 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 an external folder:

$ sudo cp /etc/nginx/ssl/laravel-cashier.local.crt ~/laravel-cashier/laravel-cashier.local.crt

In a Windows environment, you can install this certificate with a double click and select the following specific store:

Trusted Root Certification Authorities

Restart your browser. Done.

Additional information on how to add a certificate: https://technet.microsoft.com/en-us/library/cc754841(v=ws.11).aspx#BKMK_addlocal

NOTE. This is valid for a specific browser: Google Chrome

+4
source

This, as I first suspected and mentioned in my comment. The SSL configuration seems to be correct, as it reports that the connection is secure. You use a self-signed certificate that is suitable for development, but it is not signed by a recognized certificate authority, and therefore the browser does not trust it. However, as soon as you deploy your project to the general public, you will want to purchase a certificate from a recognized certification authority. After this certificate this error will disappear.

+1
source

The estate works correctly, but self-signed certificates no longer work on Chrome 58. You must manually install the root certificate in Chrome for each site. Example: link

0
source

Source: https://habr.com/ru/post/1273694/


All Articles