Instant localhost sites for PHP developers

LincLinc OwnerDetroit Icrontian
edited May 2013 in Internet & Media
1-step dev sites on your laptop:
  1. Set up PHP, nginx, and Percona
  2. Use regex to capture all .dev domains in nginx
  3. Write a shell script to create a site folder, database, and hosts file entry
In my default site definition in nginx (step 2 above):
server_name  ~^(www\.)?(?.*)\.dev$;
root         /www/$domain;
My shell script, dropped in ~/bin, named 'mkdev' and made executable (step 3 above):
read -p "Name: " SITE

#/etc/hosts
sudo cp /etc/hosts /etc/hosts.original
echo -e "127.0.0.1\t${SITE}.dev" | sudo tee -a  /etc/hosts

# copy files
sudo cp -R /www/_copy /www/${SITE}
sudo chown -R lincoln /www/${SITE}

# database
sudo echo "create database ${SITE}" | mysql -u root
The stuff in '/www/_copy' (being used to populate new sites) is a skeleton copy of Vanilla Forums created with symlinks to my local git repo. So, whenever the git repo changes, Vanilla updates on every dev site.

Now I type mkdev at the command prompt, give it a name, and go to [name].dev in my browser and start using the new site.

I posted about the Vanilla symlinks part here: http://vanillaforums.org/discussion/23877/1-step-vanilla-dev-sites
PirateNinjaBobbyDigiTushonShadowdare

Comments

  • primesuspectprimesuspect Beepin n' Boopin Detroit, MI Icrontian
    I absolutely fucking love you guys
  • LincLinc Owner Detroit Icrontian
    At least one of us does.
    UPSLynxThrax
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited May 2013
    Lincoln said:

    At least one of us does.

    <3
  • SnarkasmSnarkasm Madison, WI Icrontian
    Lincoln said:

    1-step dev sites on your laptop:

    Step 1
    Step 2
    Step 3
    Large paragraph of other unnumbered steps
  • LincLinc Owner Detroit Icrontian
    edited May 2013
    Snarkasm said:

    Lincoln said:

    1-step dev sites on your laptop:

    Step 1
    Step 2
    Step 3
    Large paragraph of other unnumbered steps
    It's how to set up 1-step dev sites... the step is "type 'mkdev' at the command prompt".
Sign In or Register to comment.