简体   繁体   中英

PhpStorm + Vagrant + Symfony2

I want to display Symfony2 page using vagrant box. If i turn on vagrant box (vagrant up), and use by ssh command "php app/console server:run" Then i see info " Server running on http://127.0.0.1:8000 " and if i go to the website " 192.168.33.10 " or " 127.0.0.1 " or " 127.0.0.1:8000 " on host machine, Then i don't see symfony2 site.

Question: How is correctly configuration the vagrant file, that allow me see symfony2 site ?

Its keys lines in my vagrant file .

      ....
      config.vm.box = "symfony-v0.2.0"
      config.vm.network "forwarded_port", guest: 8000, host: 80
      config.vm.network "private_network", ip: "192.168.33.10"
      config.vm.network "public_network"
      config.vm.synced_folder "./", "/var/www/"
      ....

Add informations:
==> default: Mounting shared folders...
    default: /var/www => C:/Users/Wojtek/PhpstormProjects/DragonisProject/Symfony2Project
    default: /vagrant => C:/Users/Wojtek/PhpstormProjects/DragonisProject/Symfony2Project

Delete line config.vm.network "private_network", ip: "192.168.33.10" from Vagrantfile. Then start server server as php app/console server:run 0.0.0.0:8000 it will listen to all ip addresses and access it as http://localhost because you have port 8000 forwarded to port 80 on host machine.

1) Make sure you set your local host file to point your site to the correct vagrant IP (192.168.33.10), if applicable. Otherwise just use the IP directly.

2) If your vagrant instance is running, the issue is likely due to your apache conf within the vagrant box.

Make sure you have the proper Apahce/nginx vhost in place for your site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM