Skip to content

Commit

Permalink
add vagrant box for env to properly test CORS issues, cleanup code to…
Browse files Browse the repository at this point in the history
… reflect more realistic scenario
  • Loading branch information
aautar committed Apr 9, 2019
1 parent 01cc3fd commit 2df2300
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@

*.log
/html
/.vagrant
53 changes: 53 additions & 0 deletions Vagrantfile
@@ -0,0 +1,53 @@
$provisioningScript = <<SCRIPT
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:nginx/stable
sudo apt-get -y update
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /vagrant /var/www
fi
# Install nginx
sudo apt-get install -y nginx=1.14.*
# Nginx
if [ ! -f /etc/nginx/sites-available/vagrant ]; then
touch /etc/nginx/sites-available/vagrant
fi
if [ -f /etc/nginx/sites-enabled/default ]; then
rm /etc/nginx/sites-enabled/default
fi
if [ ! -f /etc/nginx/sites-enabled/vagrant ]; then
ln -s /etc/nginx/sites-available/vagrant /etc/nginx/sites-enabled/vagrant
fi
# Configure host
cat << 'EOF' > /etc/nginx/sites-available/vagrant
server
{
listen 80;
root /vagrant;
index index.html index.htm;
server_name _;
location "/"
{
try_files $uri $uri/ /index.html?$args;
}
}
EOF
sudo sed -i 's/sendfile on;/sendfile off;/' /etc/nginx/nginx.conf
sudo service nginx restart
SCRIPT

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision :shell, inline: $provisioningScript
config.vm.network "private_network", type: "dhcp"
end
32 changes: 13 additions & 19 deletions index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion styles.css

Large diffs are not rendered by default.

0 comments on commit 2df2300

Please sign in to comment.