WordPress Permalinks on Nginx

If you’re running WordPress on Nginx, you may have an issue with WordPress permalinks. This article explains nicely what you need to do to configure Nginx. What the article failed to do is mention the Nginx configuration filename and its location. The filename is nginx.conf, and it’s usually located in the directory /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx, depending on your Linux distro.

# WordPress installed on root directory
location / {
  index index.php index.html index.htm;
  try_files $uri $uri/ /index.php?$args;
}
 
# WordPress installed on /blog sub-directory
location /blog/ {
    try_files $uri $uri/ /blog/index.php?$args;
}

You need to reload Nginx for changes to take effect. For Ubuntu:

$ sudo service nginx restart
# or
$ sudo /etc/init.d/nginx restart

Migrations in Laravel

Migrations in Laravel is like having version control of your database. It gives you the ability to create, modify and share a schema, as well as drop tables. Since it has version control, you can migrate and rollback your database changes with just a couple of CLI commands. Here’s a couple of examples.

To migrate:

$ php artisan migrate

To rollback:

$ php artisan migrate:rollback

In addition, you can also create a new migration table.

$ php artisan make:migration create_users_table --create="users"

It will create a file similar to this:

app/database/migrations/2015_01_01_213247_create_articles_table.php

which you can modify and add fields.