Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

the1supreme's avatar

homestead Nginx not serving webpage

Hi,

I have a completely fresh install of : a)Homestead(laravel/homestead (virtualbox, 0.2.2) b)Vagrant (v 1.7.2) c) VirtualBox (v 4.3.2) b) My host OS is Mavericks

I can launch homestead successfully: ... default: 3306 => 33060 (adapter 1) default: 3306 => 33060 (adapter 1) default: 80 => 8000 (adapter 1) default: 22 => 2222 (adapter 1) ...

Note that I have port forwarding enabled from port 8000 on my host to port 80 on my homestead VM.

MY PROBLEM: Nginx is not serving web page. Chromes error message:Error code: ERR_CONNECTION_REFUSED

I then ssh onto the VM and notice there are no sites-enabled files under /etc/nginx/sites-enabled/, but that is suppose to be irrelevant because my YAML file(from my understanding) takes care of any sites's mapping(virtual servers).

I also see there is absolultely no server section in my /etc/nginx/nginx.conf file

I then find a simple curl request returns the same error(on ports 80 and 8000) even though nginx is up and running { curl 127.0.0.1:8000 Curl: (7) Failed to connect to 127.0.0.1 port 8000: Connection refused curl 127.0.0.1 Curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused }

Any advise would be so much appreciated. Remember that my YAML file is suppose to setup any NGINX servers, so I'd like to refrain from configuring the nginx service, trying to stay away from hackjobs as this is suppose to work "off the shelf"..

Thanks alot

0 likes
10 replies
bashy's avatar

There's a few reasons for "Connection Refused" but it's most likely wrong IP/port combo or there's no service running on that port.

Can you SSH into the VM and confirm Nginx is running and it is listening on port 80? (netstat grep port 80 etc)

Can you try load 192.168.10.10 in cURL?

the1supreme's avatar

Hi Bashy,

Thank you so much for your input, and yes, you are correct; There is no service running on port 80(or ports 8000, 8080 for that matter) even though the Nginx service is running.

NETSTAT PORT 80 OUTPUT-->

Port 80 is not listening. I also Netstat with grep for ports(8000 and 8080): same result. (as you can see there is not nginx in the output):
vagrant@homestead:~$ netstat | grep 80
unix 3 [ ] STREAM CONNECTED 7801

--CURL OUTPUT-->

Same result when trying ports[8000,8080]
vagrant@homestead:~$ curl 192.168.10.10
curl: (7) Failed to connect to 192.168.10.10 port 80: Connection refused

--OUTPUT OF NGINX SERVICE STATUS-->

All the above despite the fact that Nginx is running
vagrant@homestead:~$ service nginx status
* nginx is running

So the NGINX service is running, but appears to be NOT configured properly. As can see
a) the nginx service is not listening..
and b) ports 80,8000 and 8080 are not listening:
root@homestead:~# netstat -al | grep nginx
root@homestead:~# lsof -i :80
root@homestead:~# lsof -i :8080
root@homestead:~# lsof -i :8000
root@homestead:~#

--WHAT I WANT TO ACHIEVE-->

I would like to refrain from configuring the NGINX service directly on the VM. If I have to change a config, I would like to only make changes in my YAML or Vagrantfile.

bashy's avatar

Hmm, I would try reinstall Homestead because it should normally be running automatically...

the1supreme's avatar

Thanks bashy (you've been great to my sanity),

I'll grab a copy of a colleagues ~/.vagrant.d directory tomorrow because I think he's homestead install(of a few days old) works happily.

mrchuffman's avatar

Since there isn't a correct answer yet, and this if the first result for when you search for "homestead ERR_CONNECTION_REFUSED", my solution was to do a

vagrant destroy

and then

vagrant up

on the box and now it is working fine.

1 like
MichaelHu's avatar

I have the same issue and tried vagrant destroy and vagrant up. The port still not working after the last hope I can do. I have also tried to install my mac and PC as well. The vagrant is running and nginx in the box is running. But I cannot access the homestead.app:8000 on the browser....

Do we have any tutorial someone can recommend which is very specific and detailed step by step on Mac or PC? The tutorial on the Lavavel 5.1 Doc is not working for me, :(

danielmunn's avatar

Also check to see if any ports are being overwritten in homestead.yaml

Please or to participate in this conversation.