Last active
August 29, 2015 14:06
-
-
Save LordZardeck/b1595828ca1491e52504 to your computer and use it in GitHub Desktop.
My personal dev environment install script. Uses PHP5 and NVM for node
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
server { | |
server_name ~^(?<vhost>.*)\.dev$ ; | |
root /home/nginxuser/www/$vhost.dev/public; | |
index index.html index.php; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
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
#!/bin/bash | |
# Ensure we run all this as root | |
sudo echo "Removing need for password prompt" | |
# Usefull for install mysql-server without prompts | |
# source: http://askubuntu.com/questions/79257/how-do-i-install-mysql-without-a-password-prompt | |
echo mysql-server mysql-server/root_password password strangehat | sudo debconf-set-selections | |
echo mysql-server mysql-server/root_password_again password strangehat | sudo debconf-set-selections | |
# Make sure we have the latest versions | |
sudo apt-get update | |
# Install mysql without prompts. This leaves root password blank, which is okay for me personally | |
# when I'm just using this as a dev box. Whine at how I'm so bad at security all you want ;-) | |
sudo apt-get -q -y install mysql-server nginx git php5-mysql php5-fpm dnsmasq | |
# Install nvm | |
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | bash | |
# Allow us to use nvm now | |
source ~/.nvm/nvm.sh | |
# Install node v0.10 | |
nvm install 0.10 | |
# Alias it now | |
nvm alias default 0.10 | |
# Install global development npm modules | |
npm install -g grunt-cli bower http-server | |
# Let's setup NGINX now | |
# Create the default web folder | |
mkdir $HOME/www | |
mkdir -p $HOME/www/test.dev/public | |
# Create test html page | |
cat > $HOME/www/test.dev/public/index.php << EOF | |
<html><head><title>Test Page</title></head><body><h1>It Works!</h1></body></html> | |
EOF | |
# Funky eval echo to get proper user name with sudo permissions | |
eval 'echo "wget -qO- https://gist.githubusercontent.com/LordZardeck/b1595828ca1491e52504/raw/6bd8ae58f4ad09867b5ebceed07e22b0c032ac42/nginxconfig > /etc/nginx/sites-available/$USER"' | sudo bash | |
sudo sed -i s/nginxuser/"$USER"/g /etc/nginx/sites-available/$USER | |
sudo ln -s /etc/nginx/sites-available/$USER /etc/nginx/sites-enabled/$USER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment