pixel 67
pixel 67

Reputation: 1618

NGINX not serving from localhost but is serving from 127.0.0.1

I've set up a new macbook pro with El Capitan, I used homebrew to install everything. Also using brew services to start and stop launchctl.

I'm not sure what the problem is, I have it working on my iMac and did the same thing on the MBP, the config file is untouched, so I should be getting the default welcome screen on localhost, server_name is set to localhost

Any suggestions?

Upvotes: 2

Views: 3416

Answers (1)

pixel 67
pixel 67

Reputation: 1618

So the fix was adding [::]:8080 to the nginx.conf file I used sudo lsof -i TCP -Pn | grep nginx and saw it was listening for ipv6 like @ZYWJ was hinting at.

So your nginx.conf file should look something like this:

server {
listen [::]:8080; server_name localhost; }

I installed with homebrew

I hope this helps anyone with the same problem.

Upvotes: 4

Related Questions