herd-community icon indicating copy to clipboard operation
herd-community copied to clipboard

[Bug]: can't access herd sites with .test

Open ataldev opened this issue 1 year ago • 3 comments

Platform

macOS

Operating system version

15.0.1 (24A348)

System architecture

ARM64 (M1, M2, etc)

Herd Version

15.0.1 (24A348)

PHP Version

8.2

Bug description

I know, this issue has been posted several times, but none answers my problem. I spent the entire weekend on this and now it's Sunday evening. Still can't access the sites. I was initially using Valet, then switched to Herd, the websites were working, but I don't know what happened and when this happened, all of a sudden the websites were not available. I tried a dozen things: I had MAMP, so I deleted it. I had Nginx and dnsmasq installed with Brew, I uninstalled them. I deleted Herd and reinstalled it. Force-stopped and restarted a dozen times. Created new sites in the Herd directory.

I don't know what the reason could be, but even after a fresh install, the previous websites are present on Herd sites. I followed the uninstallation guide in the documentation.

Steps to reproduce

Use my machine and do anything, it will reproduce.

Relevant log output

This site can’t be reached
Check if there is a typo in site.test.
DNS_PROBE_FINISHED_NXDOMAIN

ataldev avatar Oct 06 '24 23:10 ataldev

Is DNSmasq marked as "green" in your services? Are there other dnsmasq processes running on your system? (Maybe from brew)?

What happens if you run "ping foo.test" in your terminal?

mpociot avatar Oct 07 '24 05:10 mpociot

Yes DNSmasq is green in services. I had a DNSmasq running before with brew, I turned if off and even uninstalled it. But that did not solve the problem.

pining the site returns:

PING site.test (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.061 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.247 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.200 ms
...

I have a /etc/resolver/test file with this content:

nameserver 127.0.0.1

and a /etc/hosts file with this content:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

ataldev avatar Oct 07 '24 16:10 ataldev

I have already uninstalled Valet completely, but after running this command: sudo /Library/PrivilegedHelperTools/de.beyondco.herd.helper uninstall When I start Herd, it detects Valet.

ataldev avatar Oct 08 '24 17:10 ataldev

If you run this command, you uninstall the helper service and that triggers the onboarding every time you start Herd. So that's the issue and it would help to not run destructive commands.

sschlein avatar Oct 14 '24 08:10 sschlein

I don't think this is the problem. I uninstalled and reinstalled Herd after this. So it shouldn't affect anything.

ataldev avatar Oct 15 '24 01:10 ataldev

Did you check this and can confirm that Herd or Beyond Code can run background activities?

https://herd.laravel.com/docs/1/troubleshooting/common-issues#herd-shows-the-welcome-screen-on-every-start

sschlein avatar Oct 15 '24 05:10 sschlein

Yes, I have checked this. They are running.

ataldev avatar Oct 20 '24 21:10 ataldev

@ataldev if .test domains are accessible in the terminal it's at least not a DNS issue.

What happens if you try to access a site via curl?

For example: curl http://not-found.test

mpociot avatar Oct 22 '24 09:10 mpociot

Can't access with Curl:

❯ curl http://clucid.test
curl: (7) Failed to connect to clucid.test port 80 after 67 ms: Couldn't connect to server

❯ ping clucid.test
PING clucid.test (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.072 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.240 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.223 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.233 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.244 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.132 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.197 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.091 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.242 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.227 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=0.297 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.223 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=64 time=0.248 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=64 time=0.191 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=64 time=0.068 ms
64 bytes from 127.0.0.1: icmp_seq=15 ttl=64 time=0.111 ms
64 bytes from 127.0.0.1: icmp_seq=16 ttl=64 time=0.190 ms
64 bytes from 127.0.0.1: icmp_seq=17 ttl=64 time=0.248 ms
64 bytes from 127.0.0.1: icmp_seq=18 ttl=64 time=0.230 ms
64 bytes from 127.0.0.1: icmp_seq=19 ttl=64 time=0.160 ms
64 bytes from 127.0.0.1: icmp_seq=20 ttl=64 time=0.253 ms
64 bytes from 127.0.0.1: icmp_seq=21 ttl=64 time=0.078 ms
64 bytes from 127.0.0.1: icmp_seq=22 ttl=64 time=0.219 ms

ataldev avatar Oct 22 '24 14:10 ataldev

Alright, this at least means that dnsmasq is running correctly but Nginx isn't. What's the status of nginx when you open up Herd?

If you click on the log icon next to nginx, do you see anything?

image

mpociot avatar Oct 22 '24 14:10 mpociot

Ahaa. Nginx is running by Herd. I see this error in the logs:

2024/10/16 15:01:21 [emerg] 2529#12667: "fastcgi_busy_buffers_size" must be equal to or greater than the maximum of the value of "fastcgi_buffer_size" and one of the "fastcgi_buffers" in /Users/dp/Library/Application Support/Herd/config/nginx/nginx.conf:154

ataldev avatar Oct 22 '24 14:10 ataldev

I had this in my nginx file:

fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;

I updated the value for fastcgi_busy_buffers_size to be 96k, restarted herd, but still can't curl.

ataldev avatar Oct 22 '24 14:10 ataldev

And now your nginx error log is empty/nginx is marked as running?

mpociot avatar Oct 22 '24 15:10 mpociot

No I still see the error:

2024/10/22 11:20:04 [emerg] 41487#4699599: "fastcgi_busy_buffers_size" must be equal to or greater than the maximum of the value of "fastcgi_buffer_size" and one of the "fastcgi_buffers" in /Users/dp/Library/Application Support/Herd/config/nginx/nginx.conf:154

I restarted herd, in different ways. By quitting and relaunching, running herd restart in terminal and also using the GUI.

ataldev avatar Oct 22 '24 15:10 ataldev

Could you paste your entire nginx.conf file?

You can also force stop services by pressing down the option key when clicking on the menubar icon. But this error seems to come from some config modifications

mpociot avatar Oct 22 '24 15:10 mpociot

Okay, I solved this. In my fast_cgi_params I had different values:

fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

So I updated the fastcgi_busy_buffers_size to be 512k.

But I wonder why this has happened. I did a fresh installation of Herd multiple times.

ataldev avatar Oct 22 '24 15:10 ataldev