Aug 23, 2016

uninstall pm2

If you have created a startup script using the 'pm2 startup ubuntu' and 'pm2 save' combo, there will be a file located here $PM2_HOME/.pm2/dump.pm2. Delete this file.

kill all pm2 processes and delete them:

pm2 stop all

pm2 delete all

then restart the server:

sudo shutdown -r now

Next, remove pm2 using npm:

npm uninstall pm2 -g (Uninstall docs)

Aug 5, 2016

how to upgrade ghost blogging platform

The ghost upgrade guide is located here: http://support.ghost.org/how-to-upgrade/

I was using Ghost 0.8.0 but recently decided to go back to Wordpress since I had accidentally upgraded my skills in that department. I also secured a client project with wordpress so whilst the ghost blogging platform is cool and has  a fresh interface, I will have to circle back to it one day —especially when it has more social sharing features to it. But at the very least, getting Ghost to work is good practice for node, pm2 node process manager and nginx config skills.

Let me know if you have any questions! Bye!

Aug 1, 2016

wordpress woocommerce product image not found 404

This post has a second title: wordpress woocommerce lessons learned

Here's a list of things I did to solve issues with images not appearing on my wordpress store which uses the woocommerce plugin:


  • Properly set the 'location' block in nginx sites-available file.
  • Properly define file and folder ownership and privileges in the 'wp-content/uploads'.

Jul 28, 2016

wordpress plugin could not create directory

I installed the WooCommerce plugin in Wordpress but got this ugly looking error:
PayPal Express Checkout could not be installed (Could not create directory.). Please install it manually by clicking here.

I solved this problem by doing this:

  1. Update ownership of the plugin directory to include user and the correct group: chown -R username:www-data wp-content/plugins/
  2. Update the permissions of folders and files in the woocommerce directory: chmod -R 775 wp-content/plugins/woocommerce/
Problem solved. I deactivated and then re-activated the plugin and the error went away with Paypal express installed :)

Jul 18, 2016

wordpress cross-origin request blocked

Your web fonts can get really messed up if you don't properly define nginx to handle CORS.

This is the block I've included in my sites-enabled settings to take care of that:

location ~* \.(eot|ttf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin *;
}
Source: How do I add access control allow origin in nginx

Jul 14, 2016

413 Request Entity Too Large Nginx

railscapistrano-413-request-entity-too-large-nginx-wordpress-error


Let's go straight to the point. You need to modify max file size settings at two locations: php.ini and nginx.conf

For php.ini:
1) Open php.ini: vi /etc/php5/fpm/php.ini
2) Find upload_max_filesize = 2M
3) Change to upload_max_filesize = 32M (or larger)
4) Save and close php.ini
5) Restart services: sudo service php5-fpm restart


For nginx.conf:
1) Open nginx.conf: vi /etc/nginx/nginx.conf
2) Add this line if you cannot find it in the "http", "server" or "location" block: client_max_body_size ;
3) Modify it to 32M (or whatever size you set  in php.ini) like this: client_max_body_size 32M;
4) Restart nginx: sudo service nginx restart

Jul 12, 2016

wordpress permalinks 404 nginx

You're ready to blog.

Your head is full of ideas, words.

You've decided on this awesome (everybody says so, at least) CMS called "Wordpress".

You installed mysql in under 3 minutes flat.

Then you decided Apache web server is for dinosaurs. You're going to use something way cooler called "nginx".

You finally got everything installed and fire up wordpress in the browser.

You log in, you see your blog. Hurray! You're just like the experts.

Then you click on  a link, any link, they all give you an ugly 404 page. What the heck?

This is how I solved it:

location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
}

Go to your `/etc/nginx/sites-enabled/sitename` file and paste that line in the `location /` block

Done.

Jun 26, 2016

How to check git commit history

Is there a simpler guide than the Pro Git Book? The viewing commit history section is just too long to go through.

I need a guide that helps me move fast and is simple enough to relate at work. Recently, I've trying to find a better way to check historical commits on my repo and this is something everybody in a shared repo can relate to: you need visibility of who changed what and when. Of course, `git diff` will be the right command but we always start with `git log`.

Apparently, we are not stuck with the stock `git log` command. You can customize how your commit history is shown and there are actually several ways you can check git commit history.

Oct 27, 2015

Error 2002 Can't connect through socket '/tmp/mysql.sock

Mysql can't connect '/tmp/mysql.sock


This is one common problem. The last time I experienced it was during installation on my macbook. There are plenty of good discussions to be found. In case you have not tried, there is an official coverage of this issue at the mysql website:

The error (2002) Can't connect to ... normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service. Source: dev.mysql.com

Can't even find the mysql-server package using yum? I have that covered here.

No package mysql-server available

No package mysql?

If you are wondering why you are getting this error "No package mysql-server available" after trying yum install mysql-server, here's why:

CentOS 7 has replaced MySQL with MariaDB. Source: Rackspace.

Solution

Do a `yum install mariadb-server mariadb` instead and be on your way!

Facing an Error 2002: Mysql can't connect '/tmp/mysql.sock? I've solved that here.