Setting up the blog

For a first post, I thought it would be fitting to write down the process I followed to install this blog onto my website.

This website is hosted on a virtual server configured with an Ubuntu operating system, Nginx for the web server, MySQL for the databank, and PHP-FMP for scripting. I won’t cover any of this, since it’s pretty standard stuff.


The blog is provided by WordPress that I installed on my server. The first thing to do was to download the compressed files to a destination of my liking and extract it. One might need to use the sudo command to get the following working.

cd /var/www
tar -xvf latest.tar.gz
rm latest.tar.gz
mv wordpress blog

These files needed some proper permissions, so following the WordPress instructions, I did the following.

find /var/www/blog/ -type d -exec chmod 755 {} \;
find /var/www/blog/ -type f -exec chmod 644 {} \;
chown -R myuser:www-data /var/www/blog
chown -R www-data:www-data /var/www/blog/wp-content/uploads

The last line allows the web user from uploading files into wp-content/uploads.


As mentioned above, this server runs with Nginx, so I did the following to make it work. First, I created the /etc/nginx/sites-availables/blog file.

server {
 listen 443 ssl;
 root "/var/www/blog";

 index index.html index.htm index.php;

 charset utf-8;

 location / {
 try_files $uri $uri/ /index.php?$query_string;

 location = /favicon.ico { access_log off; log_not_found off; }
 location = /robots.txt { access_log off; log_not_found off; }

 access_log off;
 error_log /var/log/nginx/blog-error.log error;

 sendfile off;

 client_max_body_size 16m;

 location ~ \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 fastcgi_pass unix:/var/run/php5-fpm.sock;
 fastcgi_index index.php;
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_intercept_errors off;
 fastcgi_buffer_size 16k;
 fastcgi_buffers 4 16k;
 fastcgi_connect_timeout 300;
 fastcgi_send_timeout 300;
 fastcgi_read_timeout 300;

 location ~ /\.ht {
 deny all;

 ssl_certificate /etc/letsencrypt/live/;
 ssl_certificate_key /etc/letsencrypt/live/;


server {
 listen 80;
 listen [::]:80;


 location / {
 return 301 https://$host$request_uri;

Can’t forget the symbolic link in the sites-enabled so that Nginx knows that this site needs to be loaded.

ln -s /etc/nginx/sites-available/blog /etc/nginx/sites-enabled/blog

I use letsencrypt for my certificats, so I also needed to generate those.

certbot-auto certonly -a webroot --webroot-path=/var/www/blog -d

Now that all is set up, I can restart Nginx.

service nginx restart


Next up is setting up the mysql schema and user. I have MysqlWorkbench set up to connect through ssh onto my server, which makes managing mysql very easy.  I created a schema simply called blog, as well as a new user with all permissions except grant to only the schema.

I did set up the matching host to to make sure only a connection from the server itself would work.


So be able to access, I first had to creat a dns entry for it. This is a fairly simple process of me logging into the admin panel of my name provider, and creating a new CNAME.


Now that my server and dns is properly set up, I can take care of my WordPress configuration. Navigating to my new blog dns prompted a configuration screen with the details for the mysql connection. Making sure I also set the host to be, the connection was successful. I had to manually create the wp-config.php.

I also added the following line in the wp-config file to improve security of the app.

## Disable Editing in Dashboard
define('DISALLOW_FILE_EDIT', true);

And voilà, the blog is ready to go! All I have left to do now is populate it with fake real data.

Leave a Reply

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