Software Engineering in WordPress, PHP, and Backend Development

Tag: Laravel Valet (Page 1 of 2)

How To Remove Orphaned Domains from Laravel Valet

TL;DR: If you work with Laravel Valet and spin up new domains and then delete project directories whenever you’re done, Valet still maintains Nginx configurations on your system.

This create orphaned configuration files yielding false positives for active domains and this article demonstrates how to remove them.


Remove Orphaned Domains

Given the situation when you’ve updated Valet or refreshed your SSL certificates and restart the software, you may see a list of domains that you no longer have active on your system.

He’s so concerned about finding the orphaned domains. Also, he has two backpacks because he’s so productive.

That is, if you run $ valet links it yields a shorter list. So what are the orphaned domains and how do you remove them?

The orphaned domains are actually Nginx configurations, not directories or any references to projects. Since the domains are no longer active, we can remove them.

First, open your terminal and navigate to the Nginx directory:

$ ~/.config/valet/Nginx

Next, list all of the available configurations:

$ ls -l

For any configuration not listed in the $ valet links command, you can remove them by using the rm command. For example:

$ rm acme-domain.test

And that’s it. Remember you may need to repeat this whenever you remove a project that’s no longer linked.

When Valet Stops Working Properly, What Do We Do?

I’m a fan of using both Homebrew and Valet when it comes to setting up and configuring a basic WordPress development environment. Though using package managers and simple software for such like this should make things easier, it doesn’t absolve us from the occasional problems.

Case in point: There are times in which we may have to update our TLD to play nicely with Chrome and other browsers, or even upgrade the entire installation.

Unfortunately, it’s not always as easy as it should be. Technically, we should be able to uninstall Valet and update it via Composer. But I’ve personally run into some problems that relegated having to:

  • manually uninstall Valet,
  • use Homebrew to uninstall PHP and clean up what was left completely,
  • reinstall Homebrew packages,
  • install Valet,
  • verify the browser uses the same version of PHP as the installation of Valet.

It sounds like a lot of work for something that should more or less “just work” and it is quite a few steps, but they are pretty quick to set up.

Continue reading

A Short-Guide to Changing Valet’s Top-Level Domain

For years, developers have used the dev top-level domain as a way to work with local development versions of their projects.

But Google changed all of that last year.

If you’re interested in reading a bit more into this, check out the post by Justin from WebDevStudios does a good job of going into some of the details (as does this post via Daryl Koopersmith – previously working on WordPress, now working at Medium).

But for this post, I’m trying to keep it short and pragmatic. So, the former is this:

If you’re using HTTPS and a dev domain on your local machine, it’s likely going to stop working. Yes, you can add an exception with some browsers, but not all.

Changing Valet's Top-Level Domain: Firefox Security Exception

If you’ve read this blog for any particular length of time, then you know that I’m a fan of using Valet as part of my local development environment. Part of doing that means that I also secure the local sites to simulate, as much as possible, but staging and production are going to be like.

By default, Valet uses dev as it’s top-level domain, so how do we change that? Luckily, it’s pretty easy.

Continue reading

Fix Valet, WordPress, Ajax, Bad Gateway

Some time ago, I went back to using Valet for local development, and I’ve been happy with it since. Up until sometime last week, I’d yet to run into any problems.

Fix Valet, WordPress, Ajax, Bad Gateway: Valet

But when working on a WordPress plugin that imports data using admin-ajax, I kept getting a curious message in the console no matter how large or small the data was. Specifically, I was getting an error about “502 (Bad Gateway).”

The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.

And if you try to diagnose it based on that definition, you won’t get very far. It’s not that it’s wrong, but it’s that you need to modify your server configuration.

Luckily, it’s easy. Or it’s likely easy.

Continue reading

Debugging WordPress with Valet Error Logs

I’ve written a number of posts about Valet (here and here) and why I think it’s a solid option when it comes to working as a local web server for WordPress-based development.

Valet Error Logs

It’s easy to setup, it’s got built-in support for WordPress, it uses Nginx (which is often faster than Apache is my experience), and it provides a great way to allow others to tunnel into your machine for testing if that’s something you’re into doing.

But if you’re someone who spends time debugging both through Xdebug and through reading through error logs, then you may be interested in reviewing the Valet error logs (if you can find where they are kept) when debugging your projects.

Continue reading

« Older posts

© 2024 Tom McFarlin

Theme by Anders NorenUp ↑