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!

Yes, yes, hellyeah, SSL

Done it!

Courtesy of letsencrypt.org

As an aside, I got a pleasant call from my domain registration provider, 1and1.co.uk . The chap was (I think) quietly impressed with what I had done so far. Coincidentally, he called just as I was figuring out how to apply SSL to my website, offering to help set it up on my behalf (and make a little money for 1and1.co.uk ).

I told him I was quite happy getting to grips with the nitty-gritty of it, and didn’t require nor want any assistance. In fact, the harder it is, the more I’ll learn, I think I said.

I’ll figure out how to enable comments on this blog. Anyone from 1and1.co.uk feel like leaving me a “hiya!”, feel free to do so 😃

I’m rather glad he didn’t look at it yesterday, when it still had its puerile front page.

Installing Owncloud next – I’ve done it before, but on a Raspberry Pi, so this’ll be a little different. After that, a mail server?? I say that with some trepidation. Wish me luck!