Skip to content

Instantly share code, notes, and snippets.

@conanr
Created June 5, 2012 14:25
Show Gist options
  • Save conanr/2875329 to your computer and use it in GitHub Desktop.
Save conanr/2875329 to your computer and use it in GitHub Desktop.
Plausible steps to install nginx on vagrant & serve index.html
vagrant box add precise32 http://files.vagrantup.com/precise32.box
vagrant init precise32
vagrant up
vagrant ssh
in vagrant shell:
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get -y install nginx
sudo mkdir -p /var/www/static
add index.html with content to vagrant home dir
in vagrant shell:
cd /vagrant
sudo mv index.html /var/www/static
cp /etc/nginx/nginx.conf /vagrant
modify the nginx.conf file beginning on line 72
# include /etc/nginx/sites-enabled/*;
server {
listen 80;
location / {
root /var/www/static;
}
}
in vagrant shell:
sudo cp /vagrant/nginx.conf /etc/nginx/
sudo service nginx restart
in your Vagrantfile
config.vm.forward_port 80, 8081
vagrant reload
in a browser, visit http://localhost:8081/index.html
bask in the beauty of "Hello, Static World!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment