Skip to content

Instantly share code, notes, and snippets.

@mdrmike
Last active November 26, 2015 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdrmike/add6726f50ff649fea09 to your computer and use it in GitHub Desktop.
Save mdrmike/add6726f50ff649fea09 to your computer and use it in GitHub Desktop.
HowTo: Manually Setup a New Website in Drupalpro

How to Setup a New Website

============================

This is an example of how to use Drupalpro, to manually setup a Drupal7 website called foobar.dev. This does not make use of the addon drush scripts to automate the process, but demonstrates how to manually add a website.

OVERVIEW

  • Create website root folder
  • Download and extract Drupal files in this folder
  • Setup nginx vhost config
  • Enable vhost
  • Setup hosts file (so URL resolves)
  • Create a DB & USER
  • Run Drupal setup

DETAILS

  1. Create website root folder

Example

mkdir ~/websites/foobar.dev
chown :www-data ~/websites/foobar.dev
  1. Download Drupal7, open with Archive Manager (file-roller) and extract to ~/websites/foobar.dev

  2. Copy the nginx vhost config template to a new file that will be used to customize for the new website,

Example

sudo cp /etc/nginx/sites-available/TEMPLATE_drupalpro.conf /etc/nginx/sites-available/foobar.dev.conf
  1. Open the new file and follow the instructions to customizefor the new website

Example

sudo sed -i 's|##==SERVER_TLD==|foobar.dev|g' /etc/nginx/sites-available/foobar.dev.conf
sudo sed -i 's|##==PATH_TO_SITE==|/home/drupalpro/websites/foobar.dev|g' /etc/nginx/sites-available/foobar.dev.conf
sudo sed -i 's|##==D7_ONLY==||g' /etc/nginx/sites-available/foobar.dev.conf

-OR-

Example GUI

Open file as user root in Geany
sudo -i geany /etc/nginx/sites-available/foobar.dev.conf &
CTRL-H to "Find & Replace" the URL variable
CTRL-H to "Find & Replace" the website path variable
CTRL-H to "Find & Replace" to set the Drupal7-Only variable to NULL (in other words, replace with nothing)
=SAVE FILE=

  1. Create symlink in sites-enabled folder

Example

sudo ln -s /etc/nginx/sites-available/foobar.dev.conf /etc/nginx/sites-enabled/
  1. Setup /etc/hosts file to resolve to localhost for new hostname

Example

echo '127.0.0.1 foobar.dev #drupalpro' | sudo tee -a /etc/hosts

-OR-

Example GUI

sudo -i geany /etc/hosts &
ADD a line to resolve to localhost: 127.0.0.1 foobar.dev
=SAVE FILE=

  1. Create DB user & database for new website

Example

mysql -h localhost -u root -p
create database foobar_dev;
create user foobar_dev;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES ON `foobar_dev`.* TO 'foobar_dev'@'localhost' IDENTIFIED BY 'foobar_dev';
FLUSH PRIVILEGES;
exit

-OR-

Example phpMyAdmin

Navigate to: (http://phpmyadmin) login user: root | pwd: dp14

a. Click "home icon" (to navigate to home screen) b. Click "Users" (on menu bar) c. Click "Add User" (Under user list) d. Fill out form fields: username: foobar_dev, localhost, password: foobar_dev e. Enable checkbox: [x] "Create database with same name and grant all privileges" f. Scroll to bottom and select "go" to create a new user and database: foobar_dev

  1. Restart

Example

Reboot

-OR-

Example

sudo service mysql restart  
sudo service nginx restart  
sudo service php5-fpm stop # don't use restart due to bug in php5-fpm restart: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1242376  
sleep 3 && sudo service php5-fpm start  
  1. Run Drupal setup

    Example

    (http://foobar.dev)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment