Skip to content

Instantly share code, notes, and snippets.

Last active December 20, 2015 16:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Simple web-dave storage in vagrant
set -e
aptitude update
aptitude install nginx-full -y
mkdir -p /srv/data /var/run/apache2-dav
chown www-data:www-data /srv/data /var/run/apache2-dav
cat << 'EOF' > /etc/nginx/sites-available/default
server {
listen 8000;
root /srv/data;
server_name localhost;
location / {
autoindex on;
dav_methods put delete mkcol;
create_full_put_path on;
limit_except GET {
auth_basic "Vagrant DAV";
auth_basic_user_file /vagrant/htpass;
aptitude install apache2 -y
a2enmod dav
a2enmod dav_fs
cat << 'EOF' > /etc/apache2/sites-available/default
DavLockDB /var/run/apache2-dav/davlock.db
ServerName localhost
<VirtualHost *:80>
DocumentRoot /srv/data
<Location />
Dav on
AuthType Basic
AuthName "Vagrant DAV"
AuthUserFile /vagrant/htpass
<LimitExcept GET OPTIONS>
Require valid-user
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log
service nginx restart
service apache2 restart
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Run 'vagrant up' to start server
# Apache will be available at localhost:8000
# Nginx will be available at localhost:7000
# Both share htpass and data directory
# To upload file via PUT do:
# $ curl 'http://vagrant:vagrant@localhost:8000/hello.txt' -T hello.txt
# To create collection do:
# $ curl 'http://vagrant:vagrant@localhost:8000/images' -X MKCOL
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "precise32"
config.vm.box_url = "" :forwarded_port, guest: 80, host: 8000 :forwarded_port, guest: 8000, host: 7000
config.vm.provision :shell, :path => ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment