Compound Fiasco

Eeh, I made a mess of my server yesterday.

There was something still not quite right about how it was or wasn’t forwarding from digitaltinker.co.uk to https://digitaltinker.co.uk or something of that kidney. I decided that it was to be my geek project for the Saturday.

So I played around with my settings, and started to paint myself in to a corner.

I tried uninstalling my SSL from my websites, but something I couldn’t find somewhere was still redirecting my www to a disabled https even though my other subdomains were without SSL.  Thinking back, it might have been phpmyadmin, though I think I removed that too. So I started to peel away more layers, unfortunately with the accuracy of a chainsaw serial killer trying delicate brain surgery. By trying to remove the settings set by letsencrypt, I removed the keys for all SSL connections, including Remote Terminal SSH. When I tried opening a second terminal and got a message about no keys, I realised that as soon as I closed my current terminal, I could kiss my server goodbye forever.

Oh f…………

I had no recent back up of my WordPress site. I searched my browser’s cache and saved a copy of my ‘blog to desktop. And I logged in to Amazon to delete my server’s main HD and launch another base installation of Ubuntu and rebuilt my system.

This time, I’ve done it right! (I think).

All my WordPress pages redirect correctly; where https and www was absent, they’re added automatically.

I’ve made a change to phpmyadmin by moving it to its own subdomain so it doesn’t cohabit www with WordPress. Also, all passwords are upgraded to 16 character randomly generated.

Phpmyadmin turned out to be a pain though, because after installation it said some of its code was no longer supported and tumpty tumpty doodah, hang on, I’ll find the proper message…

Deprecation Notice in ./../php/php-gettext/streams.php#48  
Methods with the same name as their class will not be constructors in a future version of PHP; StringReader has a deprecated constructor

Backtrace  
./../php/php-gettext/gettext.inc#41: require()  
./libraries/select_lang.lib.php#477: require_once(./../php/php-gettext/gettext.inc)  
./libraries/common.inc.php#569: require(./libraries/select_lang.lib.php)  
./index.php#12: require_once(./libraries/common.inc.php)

And many others messages, all Deprecation Notices in ./../php/php-gettext/streams.php so it turns out that the Ubuntu maintained copy of phpmyadmin was a bit obsolete, so the Ubuntu volunteers had their own repository on launchpad that I had to add.

They recommended also updating to a more up-to-date version of php with another launchpad repository.  And that was when I found php 7.1 was available.  Jees, Linux is hard work!!  I recognise the importance of having back-ups of my working system so I am taking snapshots of sda1 when I make big changes, I don’t care if it costs me an extra 27p on Amazon or whatever.  Php 7.1 didn’t affect WordPress but borked NextCloud (maybe I should have put it in maintenance mode before upgrading php to 7.1*) so my snapshot saved my NextCloud install.

This has been the geekiest weekend in a while, and mostly recovering from the clusterf compound fiasco that was yesterday.  Phew.

*Update – did php7.1 again, this time with sudo -u www-data php /var/www/nextcloud/occ  maintenance:mode –on and NextCloud, in fact, everything survived the php upgrade 😄.  Then Ubuntu recommended removing php7.0 but NextCloud isn’t installed from apt repositories, so apt didn’t know NextCloud was dependent on php7.0 so when 7.0 was removed, NextCloud broke, and when 7.0 was reinstalled, it all came back!

Custom php settings per subdomain, ‘n’ sh*t.

So, I was trying earlier to tweak my php.ini so that it acted in one way for my NextCloud, and another for WordPress, and I cracked it with a bit of web-searching.

Php.ini has one active version, and any suggestion otherwise that I’ve read online turns out to be old advice.  To apply a blend of php setting across a single server instance, hosting more than one php service requires the setting to be ON in php.ini and OFF where required in the site’s conf file, at least in my case.

NextCloud recommends opcache.enabled=1 in php.ini (which is by default disabled by being commented out) and then there’s a few more lines of opcache settings all to enable sites to preload into RAM.  Since I have just a gig of RAM, I decided I wanted to keep WordPress from doing so too.  This was achieved by adding php_flag opcache.enable Off to the conf file in /etc/apache2/sites-available QED.

But after all that, I decided to leave that opcache feature on in WordPress and NextCloud.  My top looks like this while editing on WordPress so I don’t think I need to change

KiB Mem : 1014656 total, 140700 free, 256428 used, 617528 buff/cache
KiB Swap: 2096124 total, 2003040 free, 93084 used. 514024 avail Mem

Change of topic!  I went to a WordPress user group yesterday, which was interesting – everybody there has lots more experience of building with WordPress than me but other than that, I think the general IT skills varied hugely.  It has opened my eyes to what WordPress can do and what I can do with it.  The organiser was very clued up, he presented everything well, my mind barely wandered once during the whole two hours.  They got use of a room in a local college and was free of charge.  Can’t go wrong!

He asked me how I came to know about the group.  I said I installed WordPress and it was in the News section of the dashboard 🙄

D’you like topics?  Here’s a third!

What has a hazelnut in every bite? Squirrel shit

I got my bill from Amazon for the first months usage.  It was probably atypical for what I’ll use going forward, since I’ve done two wipe-and-reloads of my server.  As I think I mentioned before, the tiny cost of 4p for briefly storing a snapshot of my server was dwarfed by the whopping £1.03 charge for downloading my NextCloud data , at 9p per GB after the first 5GB.  Including VAT.

My next project is investigating tighter security and other plugins on WP.  Configuring it as an email server is another day yet.

C is for cookies

Ah, it was a more innocent time.

I now have a cookie disclaimer, to cover my backside.

Don’t say I didn’t warn you about the cookies.

wwwhy?

What is a site address, a domain name, a URL (an URL)?  Where does www come from?

My domain name is digitaltinker.co.uk

Apparently, it is good practice to compartmentalise all your online services into subdomains, and not have a website sat in the domain itself.  I’ve read that it helps for cookies and such like.  To this end, most websites put their content in the www subdomain and put a redirect to there from the domain.  Email servers occupy various subdomains like mail pop smtp and imap.  My NextCloud service runs from the subdomain nc.

When you type in a domain or subdomain in to your web browser, the server is contacted and it serves up the default file for that (sub)domain.  You can ask for a specific file on the server, like this page 2017/07/30/wwwhy/  When you add a specific page to the end of a (sub)domain, you have a URL or Uniform Resource Locator.  The URL for this page is www.digitaltinker.co.uk/2017/07/30/wwwhy/

When you slap an https:// at the front, you’re asking for the website’s information to be delivered securely, so while the connection is visible, the content isn’t.

So, today’s geek project has been moving my WordPress from the main domain (master domain? Dominant domain?  Domdomain!!) to the www subdomain and ensuring that all variations, with or without the www or the https land at

http s : // www . digitatinker.co.uk

I’ve also hidden the php info file in my system, and password protected it so I can view it from a browser and nobody else.  That has been my geek project of the day.

And I’ve been out for lunch and saunter and brew with friends a few towns over. Time to spend time with the fiancé methinks.

Laters

Costings and tinkerings

My plan to have NextCloud with its own php.ini file and WordPress with another went sideways. After reading tutorials that suggested I could, I read the comments that said NO! that method is no longer applicable.  Only one PHP.ini file.

It seems that if I want to accomplish this, it needs to be set in the .htaccess file to over-ride the template set by a single php.ini file and there’s another configuration file has been suggested, I forget, I’m a little inebriated.  Work in progress, may or may not amount to something.  Some php.ini settings can be over-ridden, some can’t, it seems.

Anyhoo, it seems that this enterprise hasn’t been entirely without cost.  I’ve exceeded the free download-from-server (upload-to-client) allowance.  This is  mainly because I’ve wiped and reloaded twice since the initial install and each time I’ve re-uploaded and (this is the bit where they charge) partially re-downloaded my cloud app content both times.  Having shifted something in the region of 11.2GB (the free allowance is 5GB), I’m going to be charged 82 cents.

The wonderful thing is that this exists in the first place, and free of charge for low usage.  It is your instance, your basic server, your PC on the internet, for eff all.  Add to the fact that 1and1.co.uk allow you to register a domain name that ends in .co.uk free of cost and you can point it at the IP address of choice and grab all-you-can-eat subdomains* and tweak to your hearts content (or at least, so far as I have) utterly rocks.  You wanna learn practical Linux web-server configuration?  Do it!

82 cents.  The first month isn’t out yet, and I’m charged 9 cents per GB downloaded.  I’ll be charged less than a dollar for my first month cycle I guess, and that’ll be in nine days time.  Less than a buck.  Eighty pence.  Sweet.

And I’m going to a local WordPress meet-up on Wednesday, see what else I can learn to do!

Over and out,

DT.

*10,000 subdomain allowance.

Third time lucky

Tinkering since last post

Though I’ve not posted in a few days, it’s not that I haven’t done much, but what I have done hasn’t had much impact on the site.

I’ve installed some tweaks to my configuration file php.ini , which should make my NextCloud operate a smidge faster. I’ve tried to research if I can use a different php.ini file for each of my subdomains (this blog, NextCloud and maybe in the near-future, a second WP blog) and I’ve tried setting my server up to provide http/2 support. I’ve found that http/2 is only provided by 13% of the top 10 million websites (wikipedia), and it has a higher RAM footprint than http/1.1 so I’m in no rush to provide. But I’d still like to sort out the php.ini challenge so that is a Work In Progress.

Until next time

D

It’s going down!

I feel the urge to do it all over again, wipe my instance away, reinstall the base OS, put all the gubbins back on to build my WordPress site and this time, organise my partitions properly and set up NextCloud instead of OwnCloud (I practiced NextCloud on a virtual computer at home earlier today, worked fine).

Of course, sweeping changes like this will result in some downtime.  It is 19.12 on Saturday 15/07/2017 right now, and I may stop for food, but here we go…


Back up at 21.00 exactly, and I’ve eaten my evening meal (I’ve ‘ad mi tea) and watched half an episode of Parks And Recreation but there’s gonna be some tweakage to do, and I’m doing the NextCloud stuff later. Going to watch the rest of the parks and rec episode.


Now 23.30 and everything is as it should be, and NextCloud is up, every little last tweak is applied.

Nimbo Cumulos!

The late, great Caroline Aherne

The cloud is up!  Where else would it be, clouds belong in the sky.

oc.digitaltinker.co.uk (edit, a couple of days later, I decided to redo everything and in doing so changed the cloud address to nc.digital tinker.co.uk )

More notes to follow tomorrow.  For now, I’m going to bed.  Late night geekery seems to be the theme, but at least this time it isn’t 3am

Boutros boutros ghali.


I’ve not started a new post since the next day since it’s about the same geek session.  Installing owncloud was pretty straight-forward, as I had done it a couple of times before on my Raspberry Pi; I hardly had to read the instructions.

On completion, I decided to have a go at using the remaining allocated storage space.  I set up the first virtual HD with 15GB and I have a 30GB allowance in the free-tier option.  A couple of days ago, I made a 2GB virtual drive and set it to swap space just to see that I could, so should have 13GB spare. I decided to try just a simple experiment to start with. All this is done through the Amazon Web Services (AWS) browser interface, by the way.

I shut down the server and enlarged the initial 15 GB HD to 18G and continued to read the instructions. If you’re enlarging a partition that’s boot ‘n’ root, you need to use the AWS interface to virtually unplug your drive from your shutdown server, create a new virtual server, boot it up, virtually hot plug the virtual HD, and resize your partition. I got to the resize-your-partition point then saw the next steps in CLI was more baffling to extend a gpt partition. I thought, sod it. I shutdown virtual server number two, disconnected the first servers drive, plugged it back in to my first server, booted it up, opened the virtual window and tipped the second virtual server in to the virtual canal outside. Virtually.

So now I have 15G partition in an 18G VHD, 2G swap VHD, 10G space. Then I went to bed. Earlier today, I crafted a third VHD, 10G, removed and reinstalled OwnCloud, set it’s data store to the new VHD.  Just now, I’ve thought, while it is arsey to extend a booty rooty parti, why not make one 30G drive with swap and OwnCloud partitions.

Are you still reading this? I’ll redo all that partition stuff tomorrow.

One last thought – I’ve just read that OwnCloud has forked – maybe soon I’ll try the new OwnCloud alt, NextCloud.

Bedtime!