Add blog to sudomain

 

Changing domain.com/blog to blog.domain.com needs update in 3 areas.

 

DNS :

Add the below A record to the named.domain.com file:

blog   IN A    <IP_ADDR>

 

Nginx:

Once you create a root directory to your new subdomain, place the wordpress files to this directory.

Create a new config file to your subdomain

Migrate your blog specific rewrite rules from the domain config to the subdomain config file.

You might also want to add a rewrite rule in your primary domain config to redirect returning visitors to domain.com/blog to go to blog.domain.com

rewrite ^/blog/(.*) http://blog.domain.com/$1 permanent;

 

WordPress:

From wordpress admin page navigate to Settings->General

Update the blog URL from domain.com/blog to blog.domain.com

 

Restart nginx and DNS servers after the above steps

DNS server setup without cPanel or WHM

If you had got yourself a basic VPS without cPanel and WHM and wondering how to go about setting up your DNS server, here are the basic steps:

Basic tools required: bind and bind-utils (There are more but this is good enough to get started)

(more…)

Permalinks with wordpress and nginx

By default wordpress permalinks contain index.php which can be quickly removed with 2 simple steps.

Open the nginx configuration file for your domain and add the following entry

#replace /blog with the appropriate path
location /blog/ {
try_files $uri $uri/ /blog/index.php?q=$uri&$args;
}

Reload nginx with nginx -s reload command

 

From wordpress siteadmin, go to Settings -> Permalink

Select ‘Custom Structure’ and fill the url space with /%postname%/

Now you have a neat looking blog URL

 

 

Get that VPS up and running

So you have a brand new VPS and looking to install PHP, MySQL and nginx.

It is no longer required to manually install each component as we have a lot of scripts available to take care of them all.

One of them is available here

This pretty much takes care of all the steps you need to have a running server.