-
Notifications
You must be signed in to change notification settings - Fork 30
/
Vagrantfile
65 lines (53 loc) · 2.04 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Vagrant configuration for zend-expressive workshop
# @author Enrico Zimuel ([email protected])
VAGRANTFILE_API_VERSION = '2'
$script = <<SCRIPT
# Fix for Temporary failure resolving 'archive.ubuntu.com'
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
# Install dependencies
apt-get update
apt-get install -y nginx git curl sqlite3 php7.2 php7.2-cli php7.2-fpm php7.2-sqlite3 php7.2-pdo php7.2-xml php7.2-zip php7.2-mbstring
# Configure Nginx
echo "server {
listen 8080;
root /home/ubuntu/zend-expressive-api/public;
server_name ubuntu-xenial;
# Logs
access_log /home/ubuntu/zend-expressive-api/log/access_log;
error_log /home/ubuntu/zend-expressive-api/log/error_log;
index index.php index.html index.htm;
location / {
try_files \\$uri \\$uri/ /index.php;
}
location ~ \\.php\$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
include snippets/fastcgi-php.conf;
}
# Block access to .htaccess
location ~ \\.htaccess {
deny all;
}
}" > /etc/nginx/sites-available/zend-expressive-api
chmod 644 /etc/nginx/sites-available/zend-expressive-api
ln -s /etc/nginx/sites-available/zend-expressive-api /etc/nginx/sites-enabled/zend-expressive-api
service nginx restart
if [ -e /usr/local/bin/composer ]; then
/usr/local/bin/composer self-update
else
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
fi
chmod +r /home/ubuntu/zend-expressive-api/data/oauth2/*
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'bento/ubuntu-18.04'
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.synced_folder ".", "/home/ubuntu/zend-expressive-api", id: "vagrant-root",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=660"]
config.vm.provision 'shell', inline: $script
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--name", "zend-expressive-api"]
end
end