Problems with the tramp - "404 - not found"

I am trying to make a LAMP field using Vagrant. I was told that it is very easy to use. I am completely new to networks and virtual machines, and I have very little experience with Linux / Ubuntu. I'm currently trying to follow the manual on the official documentation page: http://docs.vagrantup.com/v2/getting-started/networking.html .

I got to the network article in the documentation and cannot make it work.

Now the problem is that due to my inexperience with the Linux network and operating system, I have no idea where to start shooting. I will try to give as much information as possible.

I am using the latest version of Vagrant with the latest version of Virtualbox with Windows 8.1.

According to the tutorial, my current Vagrantfile is as follows:

Vagrant.configure(2) do |config| config.vm.box = "hashicorp/precise32" config.vm.provision :shell, path: "bootstrap.sh" config.vm.network :forwarded_port, host: 4567, guest: 80 end 

My bootstrap.sh file looks like this:

 #!/usr/bin/env bash apt-get update apt-get install -y apache2 if ! [ -L /var/www ]; then rm -rf /var/www ln -f /vagrant /var/www fi 

When I went to http://127.0.0.1:4567 , it displayed a page with an error message:

 Not Found The requested URL / was not found on this server. =================================================== Apache/2.2.22 (Ubuntu) Server at 127.0.0.1 Port 4567 

I would prefer not to edit any configuration files unless there was an explanation, as I believe this would be a workaround. But regardless, any help would be appreciated. If I need to open a port, then how am I at the point where I'm just considering using XAMPP.

+6
source share
5 answers

I had the same problem. I tried restarting apache from a stray box, I got the following warning on my terminal.

vagrant @ vagrant-ubuntu-trusty-64: ~ $ sudo service apache2 restart * Restart the apache2 web server
AH00112: Warning: DocumentRoot [/ var / www / html] does not exist AH00558: apache2: Failed to reliably determine the server fully domain name using 10.0.2.15. Set the global "ServerName" directive to suppress this message.

Having created the "html" folder, I sorted my 404 number.

Create a DocumentRoot. I ssh for a stray box and created an html folder along this path

/ var / www /

+10
source

The problem is the file /etc/apache2/sites-enabled 000-default.

Apache2 points to var/www/html and the roaming example to var/www simply removes de / html and creates sudo service apache2 restart .

+6
source

Can I access the web server inside your virtual machine?

For example, try curl localhost:80

If curl is not installed, use sudo apt-get install curl in Ubuntu and try again.

Also, have you checked the apache virtual hosts? Is there a file with 000 by default in / etc / apache2 / sites-available?

+1
source

In bootstrap.sh

there are two problems:
  • You need to start the web service. You can also vagrant ssh manually run it
  • You need to make a soft link, not a hard link.

So the script will be updated as

 $ cat bootstrap.sh #!/usr/bin/env bash apt-get update apt-get install -y apache2 if ! [ -L /var/www ]; then rm -rf /var/www ln -s /vagrant /var/www fi service apache2 start 
+1
source

I experimented with two working solutions:

First, you need to modify the /etc/apache2/sites-enabled/000-default.conf modifing DocumentRoot file in /var/www instead of /var/www/html

The second is to modify the Vagrant bootstrap.sh file as follows:

 #!/usr/bin/env bash apt-get update apt-get install -y apache2 if ! [ -L /var/www/html ]; then rm -rf /var/www/html ln -fs /vagrant /var/www/html fi 

Also, for some reason, I had to change the port forwarding configuration in Vagrantfile by adding the host_ip key, for example:

 Vagrant.configure(2) do |config| config.vm.box = "hashicorp/precise32" config.vm.provision :shell, path: "bootstrap.sh" config.vm.network :forwarded_port, host: 4567, guest: 80, host_ip: "127.0.0.1" end 
0
source

Source: https://habr.com/ru/post/989457/


All Articles