How to setup HTTPS with Laravel Homestead

Adnan Sabanovic

You probably noticed that you can’t use your with your Chrome, as it is reporting that your website is not secure.

Here is one quick but valuable trick.

I am using Homestead 5 and by default homestead uses nginx to server your files. If you have a defined in your Homestead.yaml, then if you go in /etc/nginx/ssl/you will find two files for your domain:

All you have to do is (if you are on Mac OS) is get this website your Keychain Access, and set to trust this certificate.

In order to use this file, you can vagrant ssh and copy this file to your shared folder:

sudo cp /etc/nginx/ssl/ /home/vagrant/Code/ssl

Now you can access this file from your Mac OS (wherever you setup your source folder).

Then below the All Items, click on Certificates, and find your

Then double click on it and select to Trust -> Always trust.

And that’s it. Now your setup is closer to what you should have on your production and can operate on HTTPS.

Also you may want to have a permanent redirection from http to https

server {listen 80 default_server;listen [::]:80 default_server;server_name;return 301;}

This should be placed at the top of

sudo vim /etc/nginx/sites-available/

NOTE: In case you are not seeing these keys and certificates generated by Homestead, feel free to refer to my other article

Follow me on Twitter
Add me on LinkedIn

Adnan Sabanovic

Written by

Just a tech guy involved in mastering life using mental and physical discipline. Journaling about productivity, personal development and overall growth. #Life

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade