Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

erigra's avatar

Custom certificate with Laravel Valet

I'm using Laravel Valet in my local environment, and I have secured in by running "valet secure". However, I would like to use a custom certificate, and I can't find any information on how to change from the default certificate. I need to change because I'm integrating a third party service which needs a specific certificate for testing.

Thanks in advance :)

0 likes
4 replies
Jaytee's avatar

Here's the Valet file responsible for securing a site. Based on this, you may need to create your own driver (see docs), or clone the repository, and modify this file to include your own.

https://github.com/laravel/valet/blob/master/cli/Valet/Site.php

Although, I would of thought the service you're trying to use would allow any certificate when in testing. What's the service you're using?

tykus's avatar
tykus
Best Answer
Level 104

If you have the certificate and key files needed, you can simply refer to them in the nginx config file for the site - on a Mac, this is ~/.config/valet/Nginx/your.site.test. AFAIK, that file will exist only after having valet secure on your site, so you will be replacing the lines:

ssl_certificate "/Users/erigra/.config/valet/Certificates/your.site.test.crt";
ssl_certificate_key "/Users/erigra/.config/valet/Certificates/your.site.test.key";

with the paths to the crt and key files you need.

erigra's avatar

Perfect, just what I was looking for! Thanks!

Please or to participate in this conversation.