我通过流浪汉启动了一个ubuntu vm。对下面的vagrantfile进行细化。然后是用于配置apache的apache.sh(放置在名为provision的文件夹中)文件。
启动虚拟机后出现以下错误。
Not Found
The requested URL was not found on this server.
Apache/2.4.29 (Ubuntu) Server at localhost Port 9080
我已经看到了很多相关的帖子,但是到目前为止找不到解决方案。请帮忙。
根据此video,我必须修改/etc/apache2/apache2.conf,但是对于我的简单情况,我不确定应该在配置中添加什么内容。
The Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.synced_folder '.', '/vagrant'
config.vm.network "forwarded_port", guest: 80, host: 9080 #, host_ip: "127.0.0.1"
config.vm.provision "apache", type: "shell", path: "provision/apache.sh", privileged: true
# vagrant up --provision-with=apache
end
现在apache.sh设置文件
#!/usr/bin/env bash
# sodo is not needed because Vagrant will run the script as root, so there is no need to actually use sudo.
# We are announcing to the user
echo "Installing apache ..."
apt-get update
apt-get install -y apache2
rm -rf /var/www
ln -fs /vagrant /var/www
最后,用vagrant up命令启动vm后出现的错误的屏幕截图