├── .gitignore
├── index.html
├── .provision
├── nginx
│ └── nginx.conf
└── bootstrap.sh
├── Vagrantfile
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .vagrant/
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vagrant test
5 |
6 |
7 | Oh hi!
8 |
9 |
--------------------------------------------------------------------------------
/.provision/nginx/nginx.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 |
4 | server_name vagrant-test.local.com;
5 | access_log /var/log/nginx/access.log;
6 | error_log /var/log/nginx/error.log;
7 | root /var/www;
8 |
9 | location / {
10 | }
11 | }
--------------------------------------------------------------------------------
/.provision/bootstrap.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # update packages
4 | sudo apt-get update
5 |
6 | # nginx
7 | sudo apt-get -y install nginx
8 | sudo service nginx start
9 |
10 | # set up nginx server
11 | sudo cp /vagrant/.provision/nginx/nginx.conf /etc/nginx/sites-available/site.conf
12 | sudo chmod 644 /etc/nginx/sites-available/site.conf
13 | sudo ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/site.conf
14 | sudo service nginx restart
15 |
16 | # clean /var/www
17 | sudo rm -Rf /var/www
18 |
19 | # symlink /var/www => /vagrant
20 | ln -s /vagrant /var/www
--------------------------------------------------------------------------------
/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5 | VAGRANTFILE_API_VERSION = "2"
6 |
7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8 |
9 | # Used box
10 | config.vm.box = "ubuntu/trusty32"
11 |
12 | # Accessing "localhost:8080" will access port 80 on the guest machine.
13 | config.vm.network :forwarded_port, guest: 80, host: 8080
14 |
15 | # Private Network
16 | config.vm.network :private_network, ip: "192.168.68.8"
17 |
18 | # Install stuff
19 | config.vm.provision :shell, :path => ".provision/bootstrap.sh"
20 | end
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Yannick Chenot
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | > **Note:** I do not use Vagrant for local development anymore, but Docker. I invite you to check [the tutorial series I've published](https://tech.osteel.me/posts/docker-for-local-web-development-introduction-why-should-you-care "Docker for local web development, introduction: why should you care?") about it.
2 |
3 | # Vagrant blog tutorial
4 |
5 | Repository to illustrate [How to use Vagrant for local web development](https://tech.osteel.me/posts/how-to-use-vagrant-for-local-web-development "How to use Vagrant for local web development").
6 |
7 | ## Get it running
8 |
9 | Clone the project:
10 |
11 | $ git clone git@github.com:osteel/vagrant-blog-tutorial.git
12 |
13 | Download VirtualBox at [https://www.virtualbox.org/wiki/Downloads](https://www.virtualbox.org/wiki/Downloads "VirtualBox - Downloads") (*"platform packages"*) and install it.
14 | Download Vagrant at [https://www.vagrantup.com/downloads.html](https://www.vagrantup.com/downloads.html "Vagrant - Downloads") and install it.
15 |
16 | From the project root, run:
17 |
18 | $ vagrant up
19 |
20 | Edit the `hosts` file of your machine, add:
21 |
22 | 192.168.68.8 vagrant-test.local.com
23 |
24 | Open your browser and visit http://vagrant-test.local.com
25 |
26 |
27 | For the full tutorial, please visit [How to use Vagrant for local web development](https://tech.osteel.me/posts/how-to-use-vagrant-for-local-web-development "How to use Vagrant for local web development").
--------------------------------------------------------------------------------