Useful RunCloud Hacks

In this page I shared all the RunCloud hacks that I have been using.

1) WordPress under subdirectory in Nginx

If you want to install WordPress under subdirectory in RunCloud Native Nginx stack, then this will help you configure it.

For example: If your main site located in http://example.com and you wants to install WordPress under http://example.com/subdirectory then this is for you.

First create “{app-name}.location.main.extra.conf” in “/etc/nginx-rc/extra.d/“, then add the below codes. After that reload Nginx.

location /subdirectory/ {
	try_files $uri $uri/ /subdirectory/index.php$is_args$args;
}

2) Force non-www to www in Nginx

If you would like to force non-www urls to www (or vice-versa) then use the below tricks.

First create “{app-name}.location.main-before.extra.conf” in “/etc/nginx-rc/extra.d/“, then add the below codes. After that reload Nginx.

if ($host = example.com) {
    return 301 https://www.example.com$request_uri;
}