Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Vagrant problem z uruchomieniem w przeglądarce
Forum PHP.pl > Forum > PHP
rad11
Mam problem tego typu że uruchamiam serwer w vagrancie i próbuję np wejść na localhost:1050 ale cały czas mam empty response . Co powiniennem zrobić aby ujrzeć w przeglądarce stronę testową z vagranta. Dodam że serwer to tomcat (jest zainstalowany i chodzi), a plik konfiguracyjny vagranta wyglada tak:

  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4. # All Vagrant configuration is done below. The "2" in Vagrant.configure
  5. # configures the configuration version (we support older styles for
  6. # backwards compatibility). Please don't change it unless you know what
  7. # you're doing.
  8. Vagrant.configure(2) do |config|
  9. # The most common configuration options are documented and commented below.
  10. # For a complete reference, please see the online documentation at
  11.  
  12. # Every Vagrant development environment requires a box. You can search for
  13. config.vm.box = "aerospike/centos-6.5"
  14.  
  15. # Disable automatic box update checking. If you disable this, then
  16. # boxes will only be checked for updates when the user runs
  17. # `vagrant box outdated`. This is not recommended.
  18. # config.vm.box_check_update = false
  19.  
  20. # Create a forwarded port mapping which allows access to a specific port
  21. # within the machine from a port on the host machine. In the example below,
  22. # accessing "localhost:8080" will access port 80 on the guest machine.
  23. config.vm.network "forwarded_port", guest: 80, host: 1050
  24.  
  25. # Create a private network, which allows host-only access to the machine
  26. # using a specific IP.
  27. # config.vm.network "private_network", ip: "192.168.33.10"
  28.  
  29. # Create a public network, which generally matched to bridged network.
  30. # Bridged networks make the machine appear as another physical device on
  31. # your network.
  32. config.vm.network "public_network"
  33.  
  34. # Share an additional folder to the guest VM. The first argument is
  35. # the path on the host to the actual folder. The second argument is
  36. # the path on the guest to mount the folder. And the optional third
  37. # argument is a set of non-required options.
  38. # config.vm.synced_folder "../data", "/vagrant_data"
  39.  
  40. # Provider-specific configuration so you can fine-tune various
  41. # backing providers for Vagrant. These expose provider-specific options.
  42. # Example for VirtualBox:
  43. #
  44. # config.vm.provider "virtualbox" do |vb|
  45. # # Display the VirtualBox GUI when booting the machine
  46. # vb.gui = true
  47. #
  48. # # Customize the amount of memory on the VM:
  49. # vb.memory = "1024"
  50. # end
  51. #
  52. # View the documentation for the provider you are using for more
  53. # information on available options.
  54.  
  55. # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  56. # such as FTP and Heroku are also available. See the documentation at
  57. # config.push.define "atlas" do |push|
  58. # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  59. # end
  60.  
  61. # Enable provisioning with a shell script. Additional provisioners such as
  62. # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  63. # documentation for more information about their specific syntax and use.
  64. # config.vm.provision "shell", inline: <<-SHELL
  65. # sudo apt-get update
  66. # sudo apt-get install -y apache2
  67. # SHELL
  68.  


Robie nawet tak jak na tym filmiku:

https://www.youtube.com/watch?v=ZGUEjZckijA

Z tym że musiałem dodać :

  1. config.vm.network "private_network", ip: "192.168.33.10", name: "VirtualBox Host-Only Ethernet Adapter"


Ale strony nadal nie widzę.
Pyton_000
Na jakim porcie jest serwowana strona ? Na 80 ?
rad11
Standardowo na 80 plik wygląda teraz tak :

  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4. # All Vagrant configuration is done below. The "2" in Vagrant.configure
  5. # configures the configuration version (we support older styles for
  6. # backwards compatibility). Please don't change it unless you know what
  7. # you're doing.
  8. Vagrant.configure(2) do |config|
  9. # The most common configuration options are documented and commented below.
  10. # For a complete reference, please see the online documentation at
  11.  
  12. # Every Vagrant development environment requires a box. You can search for
  13. config.vm.box = "wheezy64"
  14.  
  15. # Disable automatic box update checking. If you disable this, then
  16. # boxes will only be checked for updates when the user runs
  17. # `vagrant box outdated`. This is not recommended.
  18. # config.vm.box_check_update = false
  19.  
  20. # Create a forwarded port mapping which allows access to a specific port
  21. # within the machine from a port on the host machine. In the example below,
  22. # accessing "localhost:8080" will access port 80 on the guest machine.
  23. config.vm.network "forwarded_port", guest: 80, host: 8080
  24.  
  25. # Create a private network, which allows host-only access to the machine
  26. # using a specific IP.
  27. # config.vm.network "private_network", ip: "192.168.33.10"
  28.  
  29. # Create a public network, which generally matched to bridged network.
  30. # Bridged networks make the machine appear as another physical device on
  31. # your network.
  32. # config.vm.network "public_network"
  33.  
  34. # Share an additional folder to the guest VM. The first argument is
  35. # the path on the host to the actual folder. The second argument is
  36. # the path on the guest to mount the folder. And the optional third
  37. # argument is a set of non-required options.
  38. # config.vm.synced_folder "../data", "/vagrant_data"
  39.  
  40. # Provider-specific configuration so you can fine-tune various
  41. # backing providers for Vagrant. These expose provider-specific options.
  42. # Example for VirtualBox:
  43. #
  44. # config.vm.provider "virtualbox" do |vb|
  45. # # Display the VirtualBox GUI when booting the machine
  46. # vb.gui = true
  47. #
  48. # # Customize the amount of memory on the VM:
  49. # vb.memory = "1024"
  50. # end
  51. #
  52. # View the documentation for the provider you are using for more
  53. # information on available options.
  54.  
  55. # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  56. # such as FTP and Heroku are also available. See the documentation at
  57. # config.push.define "atlas" do |push|
  58. # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  59. # end
  60.  
  61. # Enable provisioning with a shell script. Additional provisioners such as
  62. # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  63. # documentation for more information about their specific syntax and use.
  64. # config.vm.provision "shell", inline: <<-SHELL
  65. # sudo apt-get update
  66. # sudo apt-get install -y apache2
  67. # SHELL
  68.  


Lecz też nie pokazuje strony testowej ( jak zainstalowalem debiana i php + apache2 to ten config działał wywołując localhost:8080 ) lecz w tomcat`cie ni cholery nie chce.
Dobra działa tomcat miał ustawiony defaultowo port 8080 tak więc zmiana:

  1. config.vm.network "forwarded_port", guest: 8080, host: 1234


Pomogła.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.