Last active
August 29, 2015 14:25
-
-
Save 4lun/ae778434c9dc36877058 to your computer and use it in GitHub Desktop.
Initial VM setup for dev work (Ubuntu 14.04). Mainly for Laravel and such
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run as root, change below variables | |
export PROJECT_NAME='project' | |
export DEBIAN_FRONTEND="noninteractive" # Supress mysql-server password dialog (set password during mysql_secure_installation command instead) | |
apt-get install nginx php5-fpm php5-cli php5-mysql mysql-server nodejs nodejs-legacy npm -y | |
curl -sS https://getcomposer.org/installer | php | |
mv composer.phar /usr/local/bin/composer | |
sudo -u www-data -H mkdir -p /var/www/$PROJECT_NAME/public | |
sudo -u www-data -H echo '<h1>Hello World</h1>' >> /var/www/$PROJECT_NAME/public/index.html | |
echo ' | |
server { | |
listen 80; | |
listen [::]:80 ipv6only=on; | |
root /var/www/$PROJECT_NAME/public; | |
index index.html index.htm index.php; | |
server_name $PROJECT_NAME.dev; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
} | |
' >> /etc/nginx/sites-available/$PROJECT_NAME | |
ln -s /etc/nginx/sites-available/$PROJECT_NAME /etc/nginx/sites-enabled/$PROJECT_NAME | |
service nginx restart | |
echo 'cgi.fix_pathinfo=0' >> /etc/php5/fpm/php.ini | |
service php5-fpm restart | |
mysql_secure_installation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment