Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.
I have the same problem. I don’t see the 502 error with any other website, just one. The router mode change did not help. I’m on macOS Sonoma (14.2.1), Local version 8.2.0+6554, and the Local logs file is attached. local-lightning.log (838.3 KB)
Based on the logs it looks like there might be a port conflict occurring. Here are some steps to help us identify and address this:
Stop all sites that are running in Local
Force quit Local
(If using Mac) Run the command lsof -nP -iTCP -sTCP:LISTEN
(If using Windows) Run the command netstat -ano
What you’ll be looking for here is to see when sites are stopped and Local is properly shut down if there are still programs running on ports 80 and 443. These may be conflicting with Local or the system may be reporting Local is still running.
Once you run that command you should see a list of listening ports. If you see a particular program making use of those ports, you can then kill that process by running sudo kill -9 XXX where XXX is the PID number of that process. (On Windows you will use taskkill /F /pid XXX where XXX is the PID number of that process)
After that, you should be able to retry. Keep us posted if you have any questions or continuing issues.
Thanks for the reponse. I tried this on macOS and it worked for a day. Now, all websites on Local give me a 502 - Bad Gateway error. I have tried killing processes on 80 and 443 ports as you mentioned and cleared everything in the lightning-services directory, but no luck. I have been using Local for more than a year, and this had not ever happened. What is the issue?
Found the issue in my case. It was happening on all websites that I had the Wordfence plugin installed and that was somehow messing with the nginx config! with its firewall so I used this command in the site shell terminal and deactivated Wrodfence plugin that fixed the issue: