Creating a new project

Below are the steps needed to create a new project:

On Server

Login to PhpMyAdmin :
http://phpmyadmin.christinewilson.ca/

On Local

Login to PhpMyAdmin:
http://localhost/phpmyadmin/

On Both

  1. Create user sarah with password: 575757aA
  2. Check off to create database with same name when creating

This creates an empty database with correct user assigned. WordPress will do rest when you upload files

Login to FTP with chris user and go to /var/www
Create folders: sarah/public_html

Add alias for new website since you probably won't have domain name yet

nano /etc/apache2/sites-available/000-default.conf
Alias /sarah /var/www/sarah/public_html

Save file

If you have domain name then do this

sudo cp /etc/apache2/sites-available/christinewilson.ca.conf /etc/apache2/sites-available/sweetiebee.ca.conf
nano /etc/apache2/sites-available/sweetiebee.ca.conf

Edit ServerName, ServerAlias, DocumentRoot, Directory

Enable new virtual host

sudo a2ensite sweetiebee.ca.conf

Deactivate any conf file you don't want to use right now like this

sudo a2dissite test.ca.conf

useradd -m -d /home/sarah sarah
passwd sarah

Give password: 575757aA

usermod -g www-data sarah

Add user to vsftpd

cd /etc/vsftpd
nano sarah
local_root=/var/www/sarah/public_html
htpasswd -cd /etc/vsftpd/ftpd.passwd sarah

Will ask for password now

575757aA

Then edit user home directory (not sure if this is actually needed anymore)

usermod --home /var/www/sarah/public_html sarah

Check that user can write to directory

sudo chown -R sarah:www-data /var/www/sarah/public_html
chmod 775 /var/www/sarah/public_html
/etc/init.d/vsftpd restart

For changes to take effect restart apache

service apache2 restart

Try connecting to FTP using FTP user, password and port 21

Need port 21 because WordPress doesn't allow changing of ports

On Server

Download WordPress to site

wget -c http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
sudo rsync -av wordpress/* /var/www/sarah/public_html

OLD WAY Upload WordPress zip to directory

unzip wordpress.zip

Make whole site writable for WordPress (wp-content needed for plugins, wp-admin needed for wordpress update)

I think you need to set like this instead (if you have trouble installing plugins after this then I was wrong)

find /var/www/sarah/public_html -type d -exec chmod 775 {} \;
find /var/www/sarah/public_html -type f -exec chmod 664 {} \;

Then update to belong to user:

sudo chown -R sarah:www-data /var/www/sarah/public_html

Go to IP alias or domain and follow wizard

After wizard complete, download wp-config.php and add this line to bottom so users can upload plugins using admin

if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}

On Local

Download latest Wordpress

Create new site folder under D:\sites\{site-name}

Unzip in folder

Open project in localhost:

http://localhost/{site-name}

Follow WordPress steps to hook up to WordPress database you created

https://bitbucket.org/repo/create?owner=cj4wilso

Create empty theme folder by name of project on local: D:\sites\{site-name}\wp-content\themes\{site-name} and on server by same name

Open SourceTree and copy repo URL and point to empty folder on local. Clone repo to folder and add any files you want to push to server

Press Git Flow to set up the correct branches

https://christine.deployhq.com/projects/new

  1. Choose Bitbucket and create project
  2. Choose your new repo you created
  3. Create Production Server
  4. Hostname:
    35.192.41.230
  5. Username:
    chris
  6. Check off " Use SSH key rather than password for authentication? "
  7. Copy key, open Filezilla login with chris
  8. Go to .ssh/authorized_keys and copy file to desktop
  9. Open file and add new key. Upload back to server
  10. On FileZilla open theme folder in site and copy full path. Add to "Deployment Path"
  11. Click "Create Server"

You can now deploy master branch to website

Every new website uses gulp. Below is the code to start using it on a new project.

Install the npm init package:

npm init

Complete the npm init process populating all fields.

After, install gulp:

npm install gulp@3.9.0

And gulp dependencies:

npm install gulp-sass --save-dev; npm install gulp-concat --save-dev; npm install gulp-uglify --save-dev; npm install browser-sync --save-dev; npm install gulp-rename --save-dev;

If this is your first time using gulp in a new machine, we need to install the gulp-cli:

 npm install --g gulp-cli 

For more references, check the official documentation:

https://gulpjs.com/docs/en/getting-started/quick-start

Leave a Reply

Your email address will not be published. Required fields are marked *