Quick Tip: Local Development with Opera, Nginx 502 error

By Bruno Skvorc

This doesn’t apply to you if you’re using Apache to do local development

I was doing some local dev work recently, but for the first time in my “new” browser – Opera. I set up my Homestead Improved instance and its virtual hosts as usual, but then couldn’t get anything other than a 502 error to show up:

Screenshot 2016-06-04 17.23.37

If you inspect the dev tools, you’ll notice the status is 502 – typical of an Nginx bad gateway error.

I then spent around 30 minutes starting at dead empty error logs in my VM, and re-checking the PHP socket and ports, until it hit me that I was looking in the wrong place:

Screenshot 2016-06-04 17.23.44

Opera has VPN on by default in the version that’s current at the time of this writing, and when you try to visit a valid TLD (.com, .app, .dev, etc) with the VPN on, it crashes. The error you see is the one from Opera’s VPN which is, incidentally, running Nginx.

To solve the issue, all one has to do is turn off the VPN during local development and it’ll work.

Hope this helped someone avoid more unnecessary log hunting.

Get the latest in PHP, once a week, for free.