Skip to content

Instantly share code, notes, and snippets.

@DougBeney
Last active May 23, 2018 15:46
Show Gist options
  • Save DougBeney/a630ad89a1a64fdbb7398cd3aa45e3a7 to your computer and use it in GitHub Desktop.
Save DougBeney/a630ad89a1a64fdbb7398cd3aa45e3a7 to your computer and use it in GitHub Desktop.
Minimal Vagrantfile for a basic Nginx static site
<h1>If you are reading this, it worked!</h1>
# Nginx Config
# This is located in [your project directory]/.provisions/site.conf
server {
server_name localhost;
root /var/www/site;
}
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.network "forwarded_port", guest: 80, host: 8000
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get upgrade -y
apt-get install -y nginx
systemctl start nginx
ln -sf /vagrant /var/www/site
ln -sf /vagrant/.provisions/site.conf /etc/nginx/conf.d/site.conf
systemctl reload nginx
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment