WordPress Permissions

WordPress permissions and your ability to alter them will vary widely depending on your hosting arrangements and server software. Here are my server settings based on a self managed Digital Ocean droplet running Ubuntu 16.04 and NGINX.

While your setup might well be different, there are many commonalities that will be appropriate for any hosting environment.

The recommended settings for WordPress directories and files are as follows:

Directories should be set to 750

Files should be set to 640
except wp-config.php which should be 440 or 400.

Set directory permissions

find /srv/www/your-site/ -type d -exec chmod 750 {} \;

Set file permissions

find /srv/www/your-site/ -type f -exec chmod 640 {} \;

Set wp-config.php permission

sudo chmod 440 your-site/wp-config.php

Define the fs method in wp-config.php

define('FS_METHOD', 'direct' );

Development Environments

When you are developing web applications, whether it is a Python REST API or an internal SharePoint solution, having a smooth development workflow is closely tied to having the right development environments.

Typically this would involve three or four seperate environments:

Dev
Testing
Staging
Production.

Linux commands

Whether I’m working in the terminal on a mac or on a Linux web server, here are my most used Linux commands:

ls -la

ls is used to list files and directories. The options I use most often with this command are -la.

-l
is used to show further information about the files / directories. It is the long listing format and shows file permissions, owner information, file size and time of last modification.

-a
hidden files and folders are not included by default. -a makes sure they are also shown.

 

pwd

Stands for “print working directory”. This command outputs your current location in the file system.

 

cd

Useful key combinations:

shift + a
shift + e

Sassy Colors

Sass makes managing colors in your web site much easier. Sass variables provide a simple way to assign a label to a hex value, so you never have to remember the hex value again.

For example:

$red: #962d3e;

body {
   color: $red;
}

 

Alternatively, Sass maps also work really well.

For example:

$colors: (
   red: #962d3e,
   blue: #343642
)

body {
   color: map-get($colors, red);
}

footer {
   color: map-get($colors, blue);
}