Install DOS to Unix converter
apt-get install dos2unix
Then use it like so:
dos2unix /var/www/project-create.sh
Will recursively find all files inside current directory and call for these files dos2unix command
find . -type f -print0 | xargs -0 dos2unix
Setting Up Free Custom Domain Email Addresses with GoDaddy and Gmail (2019 Edition)
Recently I went into the rats nest that is GoDaddy’s dashboard to setup a free email forwarding address for a side project. I found it fairly impossible. Thus leads me to this post.
Here is how to do this in the 2019 version of GoDaddy’s dashboard and Gmail. It will take you about 30 minutes. Just do all the things I say and you’ll get out alive.
Here we go…
- Visit your GoDaddy dashboard here. Go to the ‘My Products’ section.
- Scroll all the way down past your domains, and expand the Additional Products section. (this took me forever to find be grateful).
- Click on the ‘Redeem’ button next to Email Forwarding. In the dropdown window, select the domain you’d like a forwarding email address for and click the button to redeem the ‘100 pack.’
- Scroll up to the Workspace Email section and click on Options next to the 100 pack. Don’t click on ‘Sign It’ it won’t work if you don’t have another email with GoDaddy.
- Click on the hilariously tiny ‘Launch Control Center’ button in the top right. Yeah, GoDaddy ain’t interested in you doing this in the least. They want your money not your love.
- Check your MX Records for this domain by clicking on Tools > Server Settings. If you’re MX Records are not yet setup (GoDaddy doesn’t do it for you), navigate to your DNS settings for this domain and add the two MX records below.
- Now, once you are in the Launch Control Center click on Create Forward in the menu bar.
- Enter the email address you want to create for your domain, and enter in the Gmail email address you want to forward that email to. You may want to go ahead and enable the ‘Catch All’ feature on this screen.
- Go into Gmail, and click into Settings. Go to the Accounts and Import section and click on:
Enter the email address you want to forward, keep ‘Treat As Alias’ checked, and on the next screen fill it out like this:
Username is your personal email address
If you are like me, you’ll get this error: - If you get the Less Secure Apps error, you have to go into your Security Settings in your Google Account. Google explains this more here but just follow my steps instead of reading that. The way I ended up being able to do it was by Enabling 2 Step Verification and then requesting a custom App Password.
- Enable 2 Step Verification by click on that setting in the Security section of your Google Account and following the Steps. Be sure to have your phone nearby.
- Once you’ve enabled 2-Step, your account won’t be able to interface with ‘Less Secure Apps’ with your normal password. So, go into App Passwords in your Google Account, and create a custom password for your Mail client.
After clicking Generate you should then get a screen like this: - Copy paste that password into the yellow screen back in Gmail.
- Pray to your version of a higher power.
- Hopefully it worked! If it did you will see this screen:
- Now all you need to do is click on the email link that Google just sent you to confirm your email, then you will be able to send email from your newly created forward address!
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
- Create user sarah with password: 575757aA
- 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
Create new site folder under D:\sites\{site-name}
Unzip in folder
Open project in localhost:
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
- Choose Bitbucket and create project
- Choose your new repo you created
- Create Production Server
- Hostname:
35.192.41.230 - Username:
chris - Check off " Use SSH key rather than password for authentication? "
- Copy key, open Filezilla login with chris
- Go to .ssh/authorized_keys and copy file to desktop
- Open file and add new key. Upload back to server
- On FileZilla open theme folder in site and copy full path. Add to "Deployment Path"
- 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:
Set up new project on HQ Deploy
https://christine.deployhq.com/projects/new
- Choose Bitbucket and create project
- Choose your new repo you created
- Create Production Server
- Hostname:
35.192.41.230 - Username:
chris - Check off ” Use SSH key rather than password for authentication? “
- Copy key, open Filezilla login with chris
- Go to .ssh/authorized_keys and copy file to desktop
- Open file and add new key. Upload back to server
- On FileZilla open theme folder in site and copy full path. Add to “Deployment Path”
- Click “Create Server”
You can now deploy master branch to website
Create new Bitbucket repository and theme
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
Install WordPress for new project
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
Create new site folder under D:\sites\{site-name}
Unzip in folder
Open project in localhost:
Follow WordPress steps to hook up to WordPress database you created
Create new database for WordPress
On Server
Login to PhpMyAdmin :
http://phpmyadmin.christinewilson.ca/
On Local
Login to PhpMyAdmin:
http://localhost/phpmyadmin/
On Both
- Create user sarah with password: 575757aA
- 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
Add post categories to pages
/*
* Add categories to pages
*/
function add_cats_to_pages_definition()
{
register_taxonomy_for_object_type('category', 'page');
}
add_action('init', 'add_cats_to_pages_definition');
To set up default post categories for custom post types, please install plugin “Pods – Custom Content Types and Fields”
Remove all files and subfolders in directory
rm -r /path/to/directory/*