流浪者使用nginx拒绝连接

I've gone through the other answers on stack overflow, searched google, and still cannot figure this issue out.

I am using the following Vagrant configuration file:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.box = "ubuntu/trusty32"
    config.vm.network "forwarded_port", guest: 80, host: 8080
    config.vm.provision "shell", path: "provisioner.sh"

I don't see anything in the provisioner.sh file that seems relevant, but will post if someone thinks it is important.

I start the VM up using VirtualBox and Vagrant. I initialize a php server using

php -S localhost:8000

However, I cannot get access to any of the php files I am attempting to open in Chrome. I've tried localhost:8000 (can't be reached), localhost:8080 (403: Forbidden), and localhost:8080/index.php (404: File Not Found). Is there something I'm not configuring properly in the vagrant network configuration?

There are 2 issues -

  1. you serve your php files on localhost but your host will not be able to access them, to make your VM files accessible from your host, you can do

    php -S 0.0.0.0:8000
    
  2. your host has no access to the port 8000 of the VM so if you're using this port in your VM you need to tell vagrant to forward this port on your host. In your Vagrantfile add

    config.vm.network "forwarded_port", guest: 8000, host: 8000
    

This was you will be able to access your site from the VM on your host using localhost:8000