2014-12-24 13:51:38 +00:00
|
|
|
#! /bin/bash
|
2015-06-17 09:49:47 +00:00
|
|
|
|
|
|
|
block="
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
|
|
|
|
root /vagrant;
|
2015-09-23 07:23:25 +00:00
|
|
|
index index.html index.htm index.php;
|
2015-06-17 09:49:47 +00:00
|
|
|
|
|
|
|
# Make site accessible from ...
|
2015-09-23 07:24:43 +00:00
|
|
|
server_name flarum.dev 192.168.29.29.xip.io;
|
2015-06-17 09:49:47 +00:00
|
|
|
|
2015-09-23 07:20:10 +00:00
|
|
|
access_log /var/log/nginx/flarum-access.log;
|
|
|
|
error_log /var/log/nginx/flarum-error.log error;
|
2015-06-17 09:49:47 +00:00
|
|
|
|
|
|
|
charset utf-8;
|
|
|
|
|
|
|
|
location / {
|
2015-09-23 07:23:25 +00:00
|
|
|
try_files \$uri \$uri/ /index.php?\$query_string;
|
2015-06-17 09:49:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
location /api {
|
|
|
|
try_files \$uri \$uri/ /api.php?\$query_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /admin {
|
|
|
|
try_files \$uri \$uri/ /admin.php?\$query_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
location = /favicon.ico { log_not_found off; access_log off; }
|
|
|
|
location = /robots.txt { access_log off; log_not_found off; }
|
|
|
|
|
|
|
|
# pass the PHP scripts to php5-fpm
|
|
|
|
# Note: .php$ is susceptible to file upload attacks
|
|
|
|
# Consider using: \"location ~ ^/(index|app|app_dev|config).php(/|$) {\"
|
|
|
|
location ~ \.php$ {
|
|
|
|
try_files \$uri =404;
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
|
|
# With php5-fpm:
|
|
|
|
fastcgi_pass 127.0.0.1:9000;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
include fastcgi_params;
|
|
|
|
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
|
|
|
fastcgi_param LARA_ENV local; # Environment variable for Laravel
|
|
|
|
fastcgi_param HTTPS off;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Deny .htaccess file access
|
|
|
|
location ~ /\.ht {
|
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
|
2015-06-20 17:38:46 +00:00
|
|
|
echo "$block" | sudo tee /etc/nginx/sites-available/vagrant
|
|
|
|
sudo service nginx restart
|
2015-06-17 09:49:47 +00:00
|
|
|
|
2014-12-28 05:20:01 +00:00
|
|
|
### Setup NPM globals and create necessary directories ###
|
|
|
|
sudo chown -R vagrant:vagrant /home/vagrant
|
2015-03-08 00:57:14 +00:00
|
|
|
|
2015-10-02 07:37:11 +00:00
|
|
|
cp /vagrant/scripts/aliases ~/.aliases
|
2014-12-28 05:20:01 +00:00
|
|
|
|
|
|
|
### Create rc file ###
|
2015-10-14 00:46:31 +00:00
|
|
|
echo "source ~/.aliases" >> ~/.bashrc
|
2014-12-28 05:20:01 +00:00
|
|
|
|
|
|
|
mysql -u root -proot -e 'create database flarum'
|
2015-04-02 21:52:44 +00:00
|
|
|
|
2015-04-02 23:51:20 +00:00
|
|
|
### Setup flarum/core and install dependencies ###
|
2015-08-26 07:43:18 +00:00
|
|
|
cd /vagrant/flarum/core
|
2015-08-28 05:24:14 +00:00
|
|
|
git pull
|
2015-03-05 23:50:24 +00:00
|
|
|
composer install --prefer-dist
|
2015-10-02 07:37:11 +00:00
|
|
|
bash scripts/compile.sh
|
2015-08-26 07:43:18 +00:00
|
|
|
|
|
|
|
cd /vagrant/flarum
|
2015-04-02 23:51:20 +00:00
|
|
|
composer install --prefer-dist
|
|
|
|
composer dump-autoload
|
2015-08-11 23:45:02 +00:00
|
|
|
php flarum install --defaults
|