Technology Tales

Adventures & experiences in contemporary technology

Moving a website from shared hosting to a virtual private server

24th November 2018

This year has seen some optimisation being applied to my web presences guided by the results of GTMetrix scans. It was then that I realised how slow things were, so server loads were reduced. Anything that slowed response times, such as WordPress plugins, got removed. Usage of Matomo also was curtailed in favour of Google Analytics while HTML, CSS and JS minification followed. What had yet to happen was a search for a faster server. Now, another website has been moved onto a virtual private server (VPS) to see how that would go.

Speed was not the only consideration since security was a factor too. After all, a VPS is more locked away from other users than a folder on a shared server. There also is the added sense of control, so Let’s Encrypt SSL certificates can be added using the Electronic Frontier Foundation’s Certbot. That avoids the expense of using an SSL certificate provided through my shared hosting provider and a successful transition for my travel website may mean that this one undergoes the same move.

For the VPS, I chose Ubuntu 18.04 as its operating system and it came with the LAMP stack already in place. Have offload development websites, the mix of Apache, MySQL and PHP is more familiar to me than anything using Nginx or Python. It also means that .htaccess files become more useful than they were on my previous Nginx-based platform. Having full access to the operating system by means of SSH helps too and should mean that I have fewer calls on technical support since I can do more for myself. Any extra tinkering should not affect others either, since this type of setup is well known to me and having an offline counterpart means that anything riskier is tried there beforehand.

Naturally, there were niggles to overcome with the move. The first to fix was to make the MySQL instance accept calls from outside the server so that I could migrate data there from elsewhere and I even got my shared hosting setup to start using the new database to see what performance boost it might give. To make all this happen, I first found the location of the relevant my.cnf configuration file using the following command:

find / -name my.cnf

Once I had the right file, I commented out the following line that it contained and restarted the database service afterwards using another command to stop the appearance of any error 111 messages:

bind-address 127.0.0.1
service mysql restart

After that, things worked as required and I moved onto another matter: uploading the requisite files. That meant installing an FTP server so I chose proftpd since I knew that well from previous tinkering. Once that was in place, file transfer commenced.

When that was done, I could do some testing to see if I had an active web server that loaded the website. Along the way, I also instated some Apache modules like mod-rewrite using the a2enmod command, restarting Apache each time I enabled another module.

Then, I discovered that Textpattern needed php-7.2-xml installed, so the following command was executed to do this:

apt install php7.2-xml

Then, the following line was uncommented in the correct php.ini configuration file that I found using the same method as that described already for the my.cnf configuration and that was followed by yet another Apache restart:

extension=php_xmlrpc.dll

Addressing the above issues yielded enough success for me to change the IP address in my Cloudflare dashboard so it pointed at the VPS and not the shared server. The changeover happened seamlessly without having to await DNS updates as once would have been the case. It had the added advantage of making both WordPress and Textpattern work fully.

With everything working to my satisfaction, I then followed the instructions on Certbot to set up my new Let’s Encrypt SSL certificate. Aside from a tweak to a configuration file and another Apache restart, the process was more automated than I had expected so I was ready to embark on some fine-tuning to embed the new security arrangements. That meant updating .htaccess files and Textpattern has its own, so the following addition was needed there:

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

This complemented what was already in the main .htaccess file and WordPress allows you to include http(s) in the address it uses, so that was another task completed. The general .htaccess only needed the following lines to be added:

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.assortedexplorations.com/$1 [R,L]

What all these achieve is to redirect insecure connections to secure ones for every visitor to the website. After that, internal hyperlinks without https needed updating along with any forms so that a padlock sign could be shown for all pages.

With the main work completed, it was time to sort out a lingering niggle regarding the appearance of an FTP login page every time a WordPress installation or update was requested. The main solution was to make the web server account the owner of the files and directories, but the following line was added to wp-config.php as part of the fix even if it probably is not necessary:

define('FS_METHOD', 'direct');

There also was the non-operation of WP Cron and that was addressed using WP-CLI and a script from Bjorn Johansen. To make double sure of its effectiveness, the following was added to wp-config.php to turn off the usual WP-Cron behaviour:

define('DISABLE_WP_CRON', true);

Intriguingly, WP-CLI offers a long list of possible commands that are worth investigating. A few have been examined but more await attention.

Before those, I still need to get my new VPS to send emails. So far, sendmail has been installed, the hostname changed from localhost and the server restarted. More investigations are needed but what I have not is faster than what was there before, so the effort has been rewarded already.

Widely differing approaches

28th January 2012

The computer on which I am writing these words is running Linux Mint with the Cinnamon desktop environment, a fork of GNOME Shell. This looks as if it is going to be the default face of GNOME 3 in the next version of Linux Mint with the MGSE dressing up of GNOME Shell looking more and more like an interim measure until something more consistent was available. Some complained that what was delivered in version 12 of the distribution was a sort of greatest hits selection but I reckon that bets were being hedged by the project team.

Impressions of what’s coming

By default, you get a single panel at the bottom of your screen with everything you need in there. However, it is possible to change the layout so that the panel is at the top or there are two panels, one at the top and the other at the bottom. So far, there is no means of configuring which panel applet goes where as was the case in Linux Mint 11 and its predecessors. However, the default placements are very sensible so I have no cause for complaint at this point.

Just because you cannot place applets doesn’t mean that there is no configurability though. Cinnamon is extensible and you can change the way that time is displayed in the clock as well as enabling additional applets. It also is possible to control visual effects such as the way new application windows pop up on a screen.

GNOME 3 is there underneath all of this though there’s no sign of the application dashboard of GNOME Shell. The continually expanding number of slots in the workspace launcher is one sign as is the enabling of a hotspot at the top right hand corner by default. This brings up an overview screen showing what application windows are open in a workspace. The new Mint menu even gets the ability to search through installed applications together with the ability to browser through what what’s available.

In summary, Cinnamon already looks good though a little polish and extra configuration options wouldn’t go amiss. An example of the former is the placement of desktop numbers in the workspace switcher and I already have discussed the latter.  It does appear that the Linux Mint approach to desktop environments is taking shape with a far more conventional feel that the likes of Unity or GNOME Shell. Just as Cinnamon has become available in openSUSE, I can see it gracing LMDE too whenever Debian gets to moving over to GNOME 3 as must be inevitable now unless they take another approach such as MATE.

In comparison with revolution

While Linux Mint are choosing convention and streamlining GNOME to their own designs, it seems that Ubuntu’s Unity is getting ever more experimental as the time when Ubuntu simply evolved from one release to the next becomes an increasingly more distant memory. The latest development is the announcement that application menus could get replaced by a heads up display (HUD) instead. That would be yet another change made by what increasingly looks like a top down leadership reminiscent of what exists at Apple. While it is good to have innovation, you have to ask where users fit in all of this but Linux Mint already has gained from what has been done so far and may gain more again. Still, seeing what happens to the Ubuntu sounds like an interesting pastime though I’m not sure that I’d be depending on the default spin of this distro as my sole operating system right now. Also, changing the interface every few months wouldn’t work in a corporate environment at all so you have to wonder where Mark Shuttleworth is driving all this though Microsoft is engaging in a bit of experimentation of its own. We are living in interesting times for the computer desktop and it’s just as well that there are safe havens like Linux Mint too. Watching from afar sounds safer.

Some nice things coming through…

22nd May 2008

While everyone is making good use of WordPress 2.5.x, development continues apace for future releases of the popular blogging platform and there are some goodies coming through on the functionality front. Google Gears are being brought into play for speeding up the administration dashboard; this started out being more prominent before being made more unobtrusive. The other big change has been an overhaul of the theme gallery and, if the theme is compatible, an overview facility has been added too. So WordPress is being tweaked and improved in the background to make 2.6 an interesting release.

Keeping an eye on future WordPress releases

16th February 2008

While I haven’t mentioned WordPress in a while, it’s now heading for version 2.5 after 2.4 was skipped. Because I want to ensure that upgrading doesn’t cause problems for my blogs, I have been picking up nightly builds with Subversion from WordPress.org. The following is the command to be used and it works fine on my Ubuntu system in the folder where I want the WordPress installation directory to live. If you wish to find out more about Subversion, there is a free book on the web.

svn co http://svn.automattic.com/wordpress/trunk/

The main event is the new dashboard and that seems to be taking cues from Movable Type (I gave that a whirl recently so I may say something here about it yet). Everything is still there along with tantalising hints of prospects for customisation. In the interim, you can change the front page feeds so that they originate from other than the world of WordPress, not a bad thing given that I found WordPress Planet feeds were annoying often. Alternate theme support for the dashboard seems to be on the to-do list, as is something for plugins; we’ll see what comes of the latter. Otherwise, nothing seems to be changed or, more importantly, broken and I am able to get a mirror of my outdoors blog up and running with the only problems of any note coming from the new web address, not at all major. For now, I’ll continue to keep tabs on what’s happening and being forewarned of any future problems is a big bonus.

Update:

Recently, I found a good summary of what to expect on Blog Herald. This is one for a return visit, methinks.

WordPress update messages

27th October 2007

I have all sorts of messages littering my blog dashboard this morning telling me to upgrade to WordPress 2.3.1; I suppose that I’d better set to work with upgrading then. However, this is never something that I do without first testing on my offline blogs. And then, there’s the need to save some tweaks to WordPress source code ahead of time. I know that I could create my own plugins but that involves finding the correct hooks and it’s a subject for another time, anyway.

More useful WordPress plug-ins

22nd June 2007

Apart from a widget that puts a login form onto a blog sidebar, I am not really on the lookout for WordPress plug-ins but here are two that came to my attention recently. I have found them to be useful; maybe you will too.

The first is WordPress Admin Themer. This allows you to store wp-admin.css in your blog’s theme folder, out of harm’s way from future upgrade cycles. A neater way of otherwise storing your customisations of admin pages -- I keep changing the logout destination to the front page of my blogs -- would be a bonus but the style plug-in is a good step forward.

One use to which I was going to put WordPress Admin Themer was to hide some elements of the WordPress dashboard page but I happened accross another plug-in that does just this kind of thing: Dashboard Editor. Activating this gets you an extra admin page where you can select the components that you want to see using the tick (check) boxes. You can even take things further by having your very own dashboard instead of what WordPress offers or by activating widgets for using with your dashboard. It’s all good stuff and I have got rid of extraneous pieces such as Planet News and the getting started section (I have using WordPress long enough that I should know my way around by now…).

Turning off WordPress’ visual editor

27th March 2007

I was doing sometime that required custom XHTML and got sick 0f the way in which the Visual Editor was mangling my code so I went and turned it off. It’s not in the obvious place where I would expect it.Apparently, it’s a per user setting so you find the relevant tick box (check box in the U.S.) on the Your Profile page in the Users section on your administration dashboard. I would have expected it under Options > Writing but I suppose that they wanted to leave to choice to users without having some jobsworth administrator getting carried away with their limited authority. Speaking of Options > Writing, that’s where you can make the editing box bigger. Now, that might be another user setting… It’s hardly consistent, is it?

  • All the views that you find expressed on here in postings and articles are mine alone and not those of any organisation with which I have any association, through work or otherwise. As regards editorial policy, whatever appears here is entirely of my own choice and not that of any other person or organisation.

  • Please note that everything you find here is copyrighted material. The content may be available to read without charge and without advertising but it is not to be reproduced without attribution. As it happens, a number of the images are sourced from stock libraries like iStockPhoto so they certainly are not for abstraction.

  • With regards to any comments left on the site, I expect them to be civil in tone of voice and reserve the right to reject any that are either inappropriate or irrelevant. Comment review is subject to automated processing as well as manual inspection but whatever is said is the sole responsibility of the individual contributor.