Skip to content

Commit

Permalink
Add support for SPA site types (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
iWader authored and svpernova09 committed Apr 5, 2017
1 parent df0387c commit 39deddb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
12 changes: 12 additions & 0 deletions resources/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ function serve-silverstripe() {
fi
}

function serve-spa() {
if [[ "$1" && "$2" ]]
then
sudo dos2unix /vagrant/scripts/serve-spa.sh
sudo bash /vagrant/scripts/serve-spa.sh "$1" "$2" 80
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-spa domain path"
fi
}

function serve-statamic() {
if [[ "$1" && "$2" ]]
then
Expand Down
37 changes: 37 additions & 0 deletions scripts/serve-spa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

block="server {
listen ${3:-80};
listen ${4:-443} ssl http2;
server_name $1;
root \"$2\";
index index.html;
charset utf-8;
location / {
try_files \$uri \$uri/ /index.html;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/$1-error.log error;
sendfile off;
client_max_body_size 100m;
location ~ /\.ht {
deny all;
}
ssl_certificate /etc/nginx/ssl/$1.crt;
ssl_certificate_key /etc/nginx/ssl/$1.key;
}
"

echo "$block" > "/etc/nginx/sites-available/$1"
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"

0 comments on commit 39deddb

Please sign in to comment.