Laravel valet not working

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company
# When Laravel Valet Fails: Debugging `ERR_CONNECTION_REFUSED` As a senior developer working with the Laravel ecosystem, I've seen countless scenarios where local development tools seem perfectly fine on one front, but fail spectacularly when trying to serve applications publicly. The issue you are encountering—where `php artisan serve` works locally, but accessing your domain like `blog.dev` results in an `ERR_CONNECTION_REFUSED`—is a classic symptom of a misconfiguration in how your local server (Valet) is binding or proxying the request. This post will walk you through the likely causes and provide a systematic debugging approach to get your Laravel Valet setup working as expected. --- ## Understanding the Discrepancy: `serve` vs. Valet To understand the problem, we first need to separate what `php artisan serve` does from what Laravel Valet is designed to do. When you run `php artisan serve`, you are starting a simple PHP development server that binds to a specific port (usually 8000) on your local machine (`127.0.0.1`). This is purely for local testing and debugging; it is not a production-ready web server handling domain routing or virtual hosting. Laravel Valet, conversely, acts as a sophisticated manager that integrates with your system's web server (like Nginx or Apache) to map custom domains directly to your project directories. The `ERR_CONNECTION_REFUSED` error strongly suggests that while the PHP process is running internally, the external request hitting the domain isn't being correctly routed to that specific application via the proxy setup Valet creates. ## Systematic Troubleshooting Steps Since you confirmed basic network connectivity (`ping` works), we can rule out general internet issues and focus on the local server configuration. Here are the critical steps to diagnose this issue: ### 1. Verify Valet Configuration and Symlinks The most common point of failure is ensuring that Valet has correctly created and linked the necessary virtual host files within your system's web server configuration directory (e.g., `/etc/nginx/sites-enabled/`). **Action:** Check if the symlinks created by Valet are present and correct for your project. ```bash # Navigate to your sites directory cd /User/mickey/Sites # Check the structure Valet expects ls -l blog/ ``` If you followed the installation guide correctly, Valet should manage these configurations automatically. If not, manually review the configuration files that Valet is supposed to be using. For robust setup, understanding how services interact is key, much like when architecting complex Laravel applications on platforms like [Laravel Company](https://laravelcompany.com). ### 2. Inspect Port Binding and Web Server Status If Valet relies on Nginx or Apache, the issue might be that the web server itself isn't listening on the correct port for that specific virtual host. **Action:** Check the status of your web server and verify the configuration files related to the domain you are trying to reach (`blog.dev`). ```bash # Example for Nginx (if using Nginx with Valet) sudo nginx -t # Test configuration syntax sudo systemctl status nginx # Check if the service is running ``` If your web server is configured correctly, it should be proxying requests from `blog.dev` to the correct PHP-FPM socket managed by Valet. ### 3. Review Local Firewall Settings (Less Likely, but Important) Although `ping` works, sometimes overly aggressive firewall rules can interfere with specific application ports that web servers use for internal communication or proxying. Ensure that no local firewall is blocking traffic between the web server and PHP-FPM. ## Conclusion: The Path Forward The discrepancy you observed highlights the difference between a simple CLI command (`php artisan serve`) and a full environment setup managed by a virtual host utility (Valet). In 90% of these cases, the fix lies in ensuring the system's web server (Nginx/Apache) is correctly configured to delegate requests to the PHP process managed by Valet. Start by thoroughly reviewing the configuration files generated by Valet and verifying that your underlying web server is properly set up as a reverse proxy for those virtual hosts. By systematically checking the symlinks, service status, and potential firewall conflicts, you will resolve this connection refusal and successfully serve your Laravel application on custom domains.