I’m on OS X (Catalina). My hosts file got erased (long story) and Time Machine doesn’t have a backup of it. I’m wondering if there’s a specific way to manually recreate entries in the hosts file - I tried getting Local to create a new site so I could just copy the format, but Local won’t do it now.
I’m sure if I just knew the requirements and the format (for both the site itself and the mysql server), I could recreate them for all my Local sites. I have about 20 sites.
Short story - is there a sample of a hosts file for new Local (5.x.x) that show the setup for both a using a *.local domain and localhost:100xx?
I solved my own issue. The hosts file was, in fact, missing, and once I recreated it, I had no troubles using the localhost method to connect. I re-set my hosts file to this basic version:
Using the localhost router method in Local doesn’t actually modify the hosts file - so the ultimate problem was that the hosts file was missing.
From here, however, I was still unable to use domain routing (e.g. mysite.local) and had to resolve a port conflict on port 80 to be able to use .local domains. This is preferable for memorability and to test SSL transactions, since the localhost method won’t configure SSLs for you.
Although a few examples are on the community support board that involve some process like
sudo lsof -i :80
kill -9 80
… these solutions weren’t working for me. What I eventually did was use the Network Monitor Utility and its Port Scan panel to find out in a more concise way what was happening on port 80. I had http using port 80 (which I think represents the Apache I installed from an earlier local hosting setup at one time), so I used the Terminal command sudo apachectl -k stop (to shut down Apache).
Then I restarted Local and I’m as good as new - able to run sites with the domain router. Local, obviously, adds entries to your etc/hosts file when you change the router to Site Domains in Preferences > Advanced. The format that Local gives the domains in a hosts file looks like this, in case anyone ever needs to know:
## Local by Flywheel - Start ##
::1 siteone.local #Local Site
127.0.0.1 siteone.local #Local Site
::1 www.siteone.local #Local Site
127.0.0.1 www.siteone.local #Local Site
::1 sitetwo.local #Local Site
127.0.0.1 sitetwo.local #Local Site
::1 www.sitetwo.local #Local Site
127.0.0.1 www.sitetwo.local #Local Site
Hope this all helps someone else in the future!
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.