I created a Vagrant machine with an ubuntu 14.04 (vagrant file below).
I forwarded host port 8080 to guest port 8000.
I have a symfony project on host (Vagrant file folder) (just a symfony new myproject built).
I ssh to guest machine and execute php app/console server:run (web server is up) on /vagrant folder
I try to acces localhost:8080 from a host browser and I have no answer.
How can I access to symfony web server from host machine?
I simplified at max level my vagrant and provision files for easy readability.
This is my vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 8000, host: 8080
config.vm.network "private_network", ip: "10.10.10.10"
config.vm.provision "shell", path: "provision.sh"
end
provision.sh file:
#!/usr/bin/env bash
apt-get update > /dev/null
apt-get install --assume-yes php5-cli
when I do nmap localhost on guest machine:
Starting Nmap 6.40 ( http://nmap.org ) at 2015-10-28 09:04 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00020s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
5432/tcp open postgresql
8000/tcp open http-alt
Thanks a lot!
Jordi
Thanks to @qooplmao for this answer.
I create an answer because maybe it will be easier to find for another with similar problem.
The problem is that symfony server launched with
app/console server:run
just heard from 127.0.0.1 requests.To solve this, @qooplmao tell me we can launch symfony web server for all ip.
Just doing:
app/console server:start 0.0.0.0:8000
Oh! If you want to stop it, you have toapp/console server:stop 0.0.0.0:8000
Thanks again for your help!
in symfony3 you need to use this:
and stop server with pressing ctrl + c