Installing Custom Certificate on Laravel Valet (For using an external service)

1.2k views Asked by At

I need to install a trusted certificate for Laravel Valet (For working locally), I've installed it on my live Ubuntu servers with no problems.

Example on how I installed on Ubuntu:

  1. Installed the certificate inside this location /usr/local/share/ca-certificates/
  2. Then ran sudo update-ca-certificates
  3. sudo reboot
  4. Then it works a charm

Trying to do the same with Lavavel Valet on local

  1. Installed the certificate inside this location Users/<user>/.config/valet/Certificates/
  2. Restart valet
  3. Doesn't work

Is there an equivalent of update-ca-certificates for MacOs or Valet?

I've also installed the certificate on the MacOs keychain with no luck.

Any suggestions?

2

There are 2 answers

0
Vinnie On

If you run brew info openssl you will get a message with instructions like the following:

To add additional certificates, place .pem files in /usr/local/etc/[email protected]/certs

and run /usr/local/opt/[email protected]/bin/c_rehash I'm pretty sure this is essentially the same as the update-ca-certificates on Ubuntu.

0
JR Lawhorne On

Go into your site directory and run valet secure.

That will give you some additional site configuration in your ~/.config/valet/Nginx directory. It will also give you some automatically generated certificates in your ~/.config/valet/Certificates directory.

You can replace the certificate files it uses with whatever you'd like and adjust the configuration file to suit your needs as well. There may be an easier way but this is typically what I do.

You can also use the valet unsecure command in your site directory to reverse this.