(soft music)
- All right, so the stream starts with infinite streams.
I always have to check the Twitch is working.
Welcome everybody who is joining us today.
I hope that you are well.
As usual, if anybody has any weird sounds
or echoes or anything like that,
please do let me know in the chat.
It's very difficult for me to pick these things up
because of how the way,
because of the way OBS and all that works.
So if you have any weird sound artifacts
or you can't hear the background music
or you can't hear me talk,
please do let me know.
I'm gonna hop off camera quickly and do something
'cause I need to pause something.
(soft music)
All right, I usually get myself a nice big pot of coffee
before these streams.
This is what my coffee pot looks like.
And then I logged onto my computer.
I do the streams from my MacBook.
I work on a Ubuntu desktop
and then I do my video recording and streams
and all that from my work MacBook.
And all kinds of weird fun things went wrong
and I had to reset things and reinstall things.
So I never got around to finishing making my coffee.
So I had to rush off quickly and do that.
So I apologize.
Thank you, Steven, for confirming
that all is fine with audio.
I appreciate that.
Chris.
Oh dear, Chris is here.
So for those of you who don't know,
Chris is a friend of mine from Cavetown.
Chris is a fellow developer and speaker and streamer
and coder and gamer and all those fun things.
And so it's always a pleasant surprise
when a friend from around my note,
Nekolev Woods, joins one of my streams.
It also adds a nice little extra level of stress and pressure
'cause it's somebody you know.
But welcome, Chris.
Good to have you with us, man.
All right, let's dive in.
So the last time I did this,
we were building an Ubuntu server
for WordPress using Apache.
Thanks, Chris.
And if you missed that live stream,
this is the one over here.
We had all kinds of fun and games in that live stream.
Oh, for crying out loud.
Command V in OBS doesn't work for some reason.
Anyway, and I have to just share this with you all.
So I didn't create any,
for those of you here for this Apache session,
you'll remember that I had some frustrations
installing some things because I hadn't set up the VPS
with enough memory.
And I uploaded the recording to YouTube
and I really appreciate the fact
that YouTube auto-chaptered the video.
I didn't do this chaptering.
This is YouTube's chaptering,
but it has introduction, overview, digitalization,
resources, terminal, logging in, creating a user,
disabling root access, logging out as a user,
installing MySQL, troubleshooting, and then frustration.
And there's about 10 minutes of frustration.
So YouTube was able to determine
that I was annoyed in that video.
I just thought that was really funny when I saw that.
But yes, we managed to set up WordPress on,
sorry, something just got loud there.
We managed to set up WordPress on an Apache Ubuntu server
or an Ubuntu Apache server, if you will.
This week, it's all about Nginx.
So one of the things that I wanted to mention
is that in the comments for this meetup,
somebody shared, I think it was Mark, perhaps.
I'm not sure, let me just see here.
See more comments.
It was Roger.
Roger said that my experience with Nginx
is that it is so much better than Apache for WordPress.
I've run it using its built-in caching
along with Redis Object Cache,
and I've yet to see anything match the performance on a VPS.
And Roger is pretty correct on that score.
If you're building your own VPS
and you want the fastest option,
then Nginx is definitely the fastest option.
There is a, I'm gonna find this very quickly,
I think it was on SpinupWP.
SpinupWP did a review.
It's under caching and performance,
let me see if I can find it.
I'm not gonna find it now, am I?
Oh yes, they did one on varnish versus Nginx, Flash CGI.
And essentially Nginx is about the fastest you can get.
Nginx is better for caching static items.
And then if you enable various other things,
you can get pretty much the fastest sort of WordPress
that you can get.
The reason I still like using Apache personally
is just because Apache is a little bit more configurable.
By default, Apache supports HD access files
in the root of the WordPress directory,
so it gives you a little bit of more configurability.
If you want to enable server-level things on Nginx,
you need to be able to go into the Nginx configs
and make changes there,
which depending on your needs
might be the way you wanna go about doing things.
I was very, I'm gonna say nervous,
but I didn't get into Nginx for a while
because I was just so comfortable with Apache.
And then as I got into Nginx,
I discovered that Nginx configs
are very similar to Apache in a lot of ways.
Sometimes it just takes a little bit of research
looking for the Nginx version of the Apache config
and then implementing that.
It just means if you want to run
like a shared hosting environment
and you wanna give your users the ability
to make changes using HD access files,
you can't do that by default.
There are ways to run like Nginx on the server
and then support HD access files on the front end.
I can't remember what the correct term is.
I think it's called like reverse something or other,
but that's not something I'm gonna be able to dive into.
It's a whole different topic.
But if you're just doing it for yourself
or your business or whatever,
and you just need one server for one WordPress site,
then Nginx is pretty much the fastest out of the box.
There might be faster options.
We might be looking into one of them in a later stream,
but for now between Apache and Nginx,
Nginx is the faster of the two.
So the resources that I wanted to share
before we get started,
as I mentioned in the last stream,
I generally refer to DigitalOcean
for any kind of server related tutorials.
So I'm gonna share that link in the chat.
This is the Linux, Nginx, MySQL, PHP article.
And this is basically just installing all the core software.
You will notice in the prerequisites
that also mentioned about the initial service setup,
which is sort of a good tutorial to go through.
I'll copy that into the chat as well.
This is basically setting up your SSH access
and creating your first users and all those kinds of things.
So logging in as a route,
creating users, granting privileges,
all that kind of stuff, firewalls and all of that.
So usually you can get away with those two articles
for setting up your base server.
However, and I mentioned this last time,
the folks at SpinupWP have also created
a install WordPress on Ubuntu set of tutorials.
Now, one of the things that I like about this set of tutorials
is it's specifically aimed at WordPress.
So the folks at SpinupWP,
they run a managed WordPress hosting services,
not managed WordPress, it's managed VPS.
So essentially everything we're gonna do manually today,
they have a service that they run for you.
And I'm not trying to promote them,
I just used to work there before I joined automatic.
And so I know this set of articles exists.
It's probably the most comprehensive series of,
or guide at least if you will,
for setting up WordPress on Nginx on Ubuntu.
So I highly recommend keeping this bookmarked.
Let me grab that.
And actually what I'm gonna do is I'm gonna grab
the first chapter because the link to get
to the actual thing doesn't work the way I expect it to.
So I'll grab the first chapter
and I'll share that in the chat as well.
And so what I'm going to do today is I'm gonna mostly
be following this series of tutorials.
There might be some things that I choose to skip today
just because of time.
I'm gonna focus on the core pieces of the service setup,
but I'm kinda gonna take us from zero
to WordPress in store and hopefully if there's time,
multi-s
All right.
There's one other thing I forgot to do.
One second.
Not gonna lie, this is one of the things that I love
about the livestream format.
If I get up and walk away for a second, nobody complains.
If it's an online workshop,
I feel the need to be a little bit more formal, if you will.
And this is just me chatting to a computer.
All right, let's get into it.
All right.
So you'll notice that this guide has Ubuntu 24.04.
I'm specifically not working with 24.04,
I'm working with 22.04.
Just because that's currently the most stable LTS version.
Ubuntu released 24.04 in April of this year,
hence the numbering.
But 24.04.1 is probably not released yet.
And I generally don't,
oh, it looks like it was just released.
Interesting.
Let me see here.
It looks like I just missed the release date.
24.04, 24.04, 24.04, no, it hasn't been released.
I'm talking nonsense, it hasn't been released yet.
So I usually only recommend that one installs
the point release of an LTS
because often the new LTS has some issues
and some bugs that are being figured out.
So generally most, it's the best of my knowledge,
most hosting companies do the same thing.
They don't install the brand new LTS.
As soon as it comes out, they wait a while
because it's generally in about,
if you look at this, 22.04 was released in April.
And then usually about, what's it May, June, July, August,
but four months later, they released the first point release.
And that's usually the more stable version.
So for that reason, I've stuck to 22.04
because it's currently like the most stable LTS version.
So that's what I've installed on the machine.
I might need to log into my digital ocean account now.
That's the other reason I use digital ocean tutorials
because I have a digital ocean account
that I use for these things.
So I'm going to log in there quickly
and I hope that I can,
I need to enter my password or screen.
Let me do that quickly.
The joy about password managers
is that means you can live stream
and not share your password with people.
And I can't do it without looking at the screen,
the keyboard, so I have to look at the keyboard.
All right, let's do this.
So no, man, come now.
Let's go.
Come on, run password.
Do your thing.
Nope, didn't like that one.
Let's try it again.
That didn't work.
Check your password and try again.
Oh, that's fun.
Chris says, "My favorite password
"was resetting secrets because of too bad
"streaming not to leak."
That's why I use one password for logins.
And then I share the root password while I was streaming
and then I kill the server afterwards.
I think I actually, oh, there we go, brilliant.
So it's that one.
No, come on now.
That one.
So I'm using a domain, psychrotech.o.n.O.
It's going to send an email to that domain
and I'm going to have to open up that email off screen.
I did all of this on my desktop earlier
just to make sure everything is set up.
And then because of the fun and games with my laptop
freaking out, I didn't get time
to do all of this on the laptops.
And I have to go through all these manual steps
that I wanted to have done before we got here.
Anyway.
Yes, so I have this domain psychrotech.cio.zile
that I use for all these sort of tests and things.
And that's what we're going to be using for today's stream.
And I have the server pointing to that domain.
So once I can get logged in here,
I should have hit trust, shouldn't I?
Anyway.
Here is my set of projects.
So I did also mention this in last week's stream.
I don't, you know, personally say you must use DigitalOcean.
It's just who I use.
They've just, I've used them since they originally launched
back in whenever it was.
And I find them to be the easiest to use.
You can use Amazon ECS, EC2, Microsoft Azure,
whatever VPS you're happy with, you can use.
You just need to set up a server, a virtual server.
And what I discovered last week is make sure that server
has at least one gig of RAM.
Last week in the, not last week, last time when I streamed,
when I was trying to set up the MySQL server,
we ran into some issues and that was because of the RAM.
There wasn't enough RAM on the machine.
So make sure you've got at least a one gig.
So there's my one gig memory.
It's got a 25 gig hard disk.
It's got like one virtual CPU or something.
There's the IP address, the public IP address.
So I'm going to just ping that
and make sure that that is a valid IP.
So let's go ping.
There we go, we're getting some response, so that's great.
And then I've already set up the DNS to point
the Cycrotech domain to that IP address.
So there we go, 46101129103, 46101129193.
So that you will do however your DNS gets set up,
be it CloudFlare or if you're using a DNS service
of any kind, you need to point your DNS to the server.
All right, so let's get started.
So the first prerequisite that the folks in this guy
talk about is getting some kind of domain name.
It just makes it easier to have it connected to a domain
as opposed to using the IP address all the time.
Also makes it easier to remember.
So that's a recommendation.
Then they recommend DigitalOcean
and they have all their docs and you can set it up.
There's all the steps there.
Spenum recommends at least two gigs of memory.
For our purposes, I'm going with one.
Two gigs is recommended if you're powering high-end sites.
I've always got away with my personal sites
at a one gig of memory server
because I don't have like high traffic sites.
Then set up the password option.
We'll talk about root access in a second.
And then you can add all these other things if you want,
but they take you through the steps and through the process.
And then we log into the server.
So I'm going to off screen, I'm gonna copy out
the root password for the server.
And I'm gonna log in.
So in my terminal, I'm going to sshn root at,
and I can just go, psychrotec.cosa.
I could use the IP address as well if I wanted to.
And it tells me that there's an error.
And this is because I was previously using this domain
for another IP address.
So I can just remove line 43 from my known hosts.
And there is a single command you can run to do that.
And I'm gonna just Google that quickly.
Quickly remove line from hosts.
It's like I said, actually, you know what?
I'm not even gonna bother.
I'm actually just gonna log into it.
No, not that one.
And this you probably won't have an issue with
if you've never ssh into servers like this before.
This is just because I've done this password again.
This is the one downside of reusing domain names
and reusing servers.
So I'm gonna scroll right down to the bottom here
and find psychrotec.
There it is, nice and quick and easy.
And I'm gonna just Control + K to cut that
and Control + X to exit out of there
and say yes and update my known hosts.
So now I should be able to log in again.
So root@psychrotec.cosa ssh, there we go.
There we go.
That's asking me about fingerprints
and am I happy with this?
I know the server is my server, so I'm happy to log in.
So I will just go ahead and say yes.
And then what's that gonna do?
It's gonna add that key to my list of known hosts.
So it's basically recreating the record we just deleted
and then I need my root password.
So let's copy that out.
And we log in and there's the server.
We're logged in.
How boring, text on a white screen.
But as you can see, it's running 220404, which is great.
That's what we want.
It's using 6% of its 24 gigs of hard drive space.
It's using 21% of the memory.
So that shows you even a server is using 21,
so why is that 200 megs of a one gig memory space?
And then there's some updates that can be done.
So this was also something I didn't do last week.
The first thing I didn't do was update my server.
So always update your server
the first time you have it set up.
It's weird to me that, and I guess it's just the way it works.
When DigitalOcean, when you install the server,
it's obviously just using an image
of the server install software.
And then there's always gonna be some updates
that will have happened since the last release.
So the first thing is to use sudo and run apps update.
If you don't know what sudo is,
basically it's a way of running things as a root
without switching to the root user,
which is always recommended.
sudo also adds some protections around doing things
that you shouldn't be able to do.
So it warns you if you're trying to do things
that you shouldn't be able to do.
I don't know why I'm doing that now
'cause I'm logged in as root, so it actually doesn't matter.
(laughs)
So I can just run upgrade.
I could have just run update previously.
So I'll just run upgrade now,
and I want to, yes, continue with all of that.
So the sudo wasn't needed and I'm being daft.
All right, so that'll make sure that I've got my latest
and greatest in all the software on the server.
And while that's doing its thing,
I'm gonna start reading through what we need to do next.
So it's gonna ask for the password, yes.
Then they recommend setting a host name.
This is useful if you have a domain name
pointing to your server.
It makes connecting to the server much easier in the future
as you don't have to remember IP addresses and all that.
So I'm going to set up the host name.
So I'm gonna copy that line.
Okay, this is telling me there's a new kernel,
do I want the kernel?
Restarting the system to load the new kernel
will not be handled automatically,
so you should consider rebooting.
All right, well, let's do that.
This is not something you'll always see happen,
but sometimes there can be an upgraded kernel.
So let's go ahead and do that.
I'm just gonna say, yeah, that's fine.
I don't mind that.
In case you're wondering, I'm using tab
just to jump between those options
as things are being installed.
And it did recommend restarting the server,
so I'm gonna do that now.
So I'm gonna go shut down minus R now.
What that does is that reboots the server,
and I'm gonna have to SSH it again.
So while we're doing that, let me copy this line.
So I'm gonna copy that.
I like to keep my digital ocean window open
because if I do need to reboot the server
or whatever the case may be,
it'll actually show me the status.
Let's have a look here.
Let's have a look at power.
Okay, so we can turn off power cycle.
Let's have a look at the graphs.
Okay, it looks like it's up and running again,
so we should be able to log in.
VPS is a really quick to connect.
So I'm gonna hit control R,
and then I can go through my SSH history,
my terminal history, sorry.
And there it is, so it's root at, here we go.
Okay, it's asking me for the password.
So let's copy that out.
That in.
Cool, there we go, so we're up and running.
So then let us go and grab this command
to set the host name.
And I'm just gonna paste that in,
and I'm just gonna change this to
PSYKRO.
There we go, so I'm just setting the host name
to the same name as the domain,
and that's all good.
All right.
Then it talks about all kinds of other things.
Not gonna worry too much about those.
It talks about setting the time zone.
I'm not gonna worry about that now,
it's not important to me.
Then it talks about the server upgrades.
So it also recommends using dist upgrade instead of upgrade
because it will intelligently handle dependencies.
Again, that's down to personal preference.
And then you can auto remove outdated packages.
I'm not gonna worry about that now.
And there we go.
Then there's a section on automatic security updates.
Now this is something that somebody asked me about
in the last live stream.
I'm not gonna run this now.
I'm not gonna set this up,
but this is a very good idea to do.
So basically if there are any security updates
that come out,
if there's anything that is discovered
that will make your server insecure,
setting up the unattended upgrades package
will ensure that all of your security updates are installed.
So I do recommend doing that if you're doing this
on an important server, like a production server,
whatever the case may be.
I'm not gonna worry about that now,
but these instructions will take you through all of it.
Then the next good thing to do
is to create a new user on the server.
So the reason for this is that you don't really want
to leave your root user account enabled.
You really want to actually shut that down.
And so to do that, you create a new user.
You can call it your administrator user,
whatever you wanna call it.
And then you add that user to the sudo group
so the user can execute root commands,
but without actually being the root user.
So the first step is to add the user.
So I'm just gonna go add user
and I'm gonna just clear my screen.
So I'm just gonna go add user and I'm gonna go Jonathan.
You can make a draw name or admin or whatever you prefer.
It asks a bunch of questions.
It's gonna ask me for a new password for Jonathan.
So I'm trying to type in a password
that I'll remember for now.
(upbeat music)
Here we go.
It's gonna ask me for the password again.
Right.
And then it asks you for details about the user themselves.
So I'll just pop in my name.
I don't have a room number.
I'm not gonna put in my work phone
or home phone or anything else.
And there we go.
So all that information is largely relevant
except for your name.
So we've created the user.
Then we need to add the user to the pseudo group.
So it's this command over here, usermod.
So let's go usermod ag pseudo Jonathan.
There we go.
That's been done.
And now it says it recommends to ensure your account
is working, logging out of your current SSH station
and initializing the new one.
So log out and then log in as that user.
So let's test that out.
So let's exit out of here.
Okay.
Recruit out of that.
So now let's go SSH Jonathan@psychrotech.ca.
It's gonna ask me now for my password that I just set up.
So let's pop that in.
And there we go.
So now we're logged in as the Jonathan user.
You can see it says Jonathan@psychrotech here.
So now if I was to run something like apt update,
it would say, I don't have permission to do that.
So I have to run all my commands that I need to run
as a route with the word pseudo in front of it.
So that's one little interesting thing
about setting that up.
Then it talks about generating a key pair.
This is the best way to connect to your server
using your local key pair.
You basically create your key pair.
You set up your SSH key.
You then copy your public key to your server
and you create a place for it on the server.
So you go back into the server and set it up,
set up the SSH directory.
And then within the directory, you create authorized files
and then you go back to your computer
and you cat the local public key
and then you paste it into your server.
So to make this a little bit easier to follow,
I've already done the public private key bit.
So I've already done that over here.
So this line I've already done.
I've already got my public and private key on my machine.
So I'm gonna jump straight ahead
to copying it over to the server.
So what I'm gonna do to make that a little bit easier
is I'm going to side by side to terminal windows.
So we'll pop this one over here.
And I know there are ways that you can run multiple tabs
and things within things.
I just have it as a plain terminal.
So I'm going to exit on the left here.
And now I'm on my MacBook on the left.
And on the right, I'm going to SSH into the server
with my password.
And there I'm in the server.
So that's how I'm gonna remember which is which.
I find this easier to sort of remember which is which.
Obviously, if you look at the terminal heading,
terminal title tag, title bar, sorry,
it's got the server name and all of that.
So that makes it easy to remember.
And this is locally on my machine.
Okay, so the first step I need to do
is I need to set up these things on the server.
So I need to make that folder on the server.
And this is inside of this, not that command, sorry.
I didn't copy that properly.
Let's go back and do it this way.
Just copy these two.
So I don't need both commands.
But this is inside the home directory of this user.
So I'm gonna make the .ssh folder.
And then I'm going to run the chmod command
to change, I think it's permissions.
Yeah, permissions to that, of that directory.
So I'm gonna run that.
And then I wanna create the new authorized keys file.
So I'm gonna copy that.
Now there's a couple of ways you could do this.
You could use touch.
That's another Linux command.
This instruction just says you're using nano,
which is a text editor.
So basically it'll create the file and then open it.
So now it's an empty file.
So I can just press Ctrl + X.
And now I should be able to see it.
So let's just go see the .ssh.
No, it didn't create the authorized keys.
That's actually a bug in there.
Oh, they're leaving it open.
And then we're, okay, sorry.
Then we go back one step, okay.
So what they're suggesting is run the nano bit
and then leave it open there.
And then on this side over here,
run your command to copy your public key
from your local machine.
Now I'm not gonna do this on screen,
but this is the command to run.
Actually, I don't think it matters if I do it on screen
'cause I don't think anybody can do anything
with my public key.
But I can't remember.
(soft music)
Maybe I'm being silly, I don't know,
but I think it should be fine.
And still click Google search.
Is it safe to share your public?
Pretty sure it is.
Yes, it's safe to share.
Yes, okay, yeah, so it's fine.
Nobody can do anything with it.
So I run this command.
So this cat command will basically
output it onto the screen, the public key contents,
and then pbcopy will copy it to the clipboard.
So I'm gonna run that and it's done that.
Oh, it actually doesn't even show it, that's fine.
And then I'm gonna paste it into my authorized keys file.
So I'm just gonna right click here and I'm gonna go paste.
So there it is.
And that's now sitting in the authorized keys file
so I can save that.
Yes, let's save that.
Okay, so that's done.
And now we can go back to the instructions.
Okay, and then it says paste your public key,
control X and then Y to save it,
and then finally set the correct permissions on the file.
So we need to set those permissions here.
So let's run that.
Right, so now the permissions are set.
Now if you log in,
you should no longer have to enter your password.
If you set a password, it's going to create the key,
you will need to enter it when prompted.
So now if I exit out of here
and I run SSH Jonathan at Cycrotech,
it might still ask me for my password once
to unlock the power of written public key,
but if it doesn't,
then it should just log me straight into the server
'cause I probably unlocked the key somewhere else.
I think it's in my Mac key chain
so it unlocks when I log into the machine.
But now it means I don't have to use my password every time.
So that's a good first step to start off with there.
Okay, so that's setting up the user.
Then it's recommended that you disable root login.
So you basically disable SSH access with a root user
and then you also disable password authentication
so that people have to log in with an SSH key.
So essentially what I'm doing is I'm making sure
that only this computer with this public and private key pair
can log into that server.
And this is a very good thing to do.
So I'm going to do those very quickly now.
So let's copy this one out.
(soft music)
There we go.
And now it's going to ask me for the password on the server,
which I expect.
Okay, and then I need to look for a mid root login.
Now in nano, you can use the control W keyboard combination
to search and then you can just paste your text in there,
permit root login, and there it is.
And I think I need to change that to, no, yes.
No.
Okay, so let's go and do that.
Change that to no.
I think that's all I need to do inside of that.
So yes, I want to save.
Yep.
And then I need to restart the SSH service.
So let's do that.
Okay, that's the service restarted.
Then I need to,
now it says if exit the current session,
try reconnecting, you should receive
a permission denied error, the final steps.
I'm just going to jump right ahead
to disabling user login.
So I'm going to copy that out and paste that there.
Ideally, if this is the first time you're doing it,
I do recommend testing all these steps,
but I've done this a few times before,
so I feel fairly comfortable to just go ahead
and say password authentication.
And now what we do is we remove the hash
because that's commented out,
and we say password authentication, no.
Is that right?
Yes, that's right.
All right, so we can exit out of that
and say hit Y to save it and enter to write it to that file.
And then we restart the server again.
Now, normally I just do both of these at the same time,
and then I just restart the server once,
but it's not a bad idea to try it again and again.
Okay, so what I'm going to do now
is I'm going to first try in my MacBook,
and this is another reason why I like to have
the two terminal side by side.
I'm first going to try and log into the server as root,
root@psychotech.cozer, and it should deny me.
It's asking for a password,
but it should still deny me
even though I enter the password.
(
)
Yeah, permission denied, excellent.
And then I want to kind of here,
then I want to actually try and log in as the root user
and just make sure that I can still log in,
not the root user, sorry, my user,
and make sure I can still log in.
So I'm going to go ssh, Jonathan@psychotech.cozer.z,
and you'll notice I'm leaving this window open here,
and there's a good reason for that
because if this all went wrong,
I've got nowhere back in the server.
So I like to just leave one logged in instance.
Cool, I'm in, I'm happy days.
Okay, so that's all worked well.
And it asks if you should,
there's steps to follow,
if you're still having problems, that's fine.
Okay, so we've got all of that.
So now only I can log into this machine
with my public and private key,
root users can't log in, so we're good to go.
All right, I'm going to exit out of one of these.
And what I'm gonna do is I'm going to bring
the instructions side by side,
so we're gonna have to keep jumping back and forth.
The next step they talk about
is configuring uncomplicated firewall.
So you do wanna have a firewall on your server,
you basically only want to allow traffic,
especially if it's a WordPress server,
you only want to allow your HTTP and HTTPS traffic,
maybe FTP later on, but maybe not.
And then ideally your SSH access you want to allow,
but everything else you want to shut down.
So uncomplicated firewall is a great way to do that
on an adventure server, so it's just one command that we run.
And then we just use these commands
to allow the different server types.
I don't know who posted this,
but no, I don't want to see a naked.
(laughs)
I don't know if everybody else can see that,
but no, that's kind of not where we're about here folks.
(laughs)
You have been, where's the...
Okay, looks like I heard what that was, didn't hang around.
Why is this not installing?
Ah, there we go, okay.
Okay, so that's all of being installed.
I don't know if anybody else can see that message
in the chats, I apologize for that.
I'm trying to figure out how you can mute somebody,
they must be away.
Block them, ah, there we go.
There we go.
Did I remind me folks, just reporting,
spam in my chat.
(soft music)
Chris is super complicated with the new UI.
I searched for this ages last time.
Yeah, I'm still, I've been sort of on and off stream
for a while and I still don't understand
all of these things, but I'm managing.
Okay, so now we've got UFW installed.
So now we can just run sudo ufw allow ssh.
And this is one of the things I love about UFW,
I can just allow a specific type of service.
So ssh is one,
HTTP is the other and HTTPS is the third.
If I wanted to allow FTP, I would allow that now,
but I'm not going to.
So I can run that to review it, but I'm happy with that.
Let's actually just do that, let's go.
sudo ufw show added.
Cool, that's all done, we're happy with that.
And now we just run sudo ufw enable.
Command may disrupt existing SSH connections.
Yes, please go ahead, let's do it.
Firewall is active, excellent.
And then let's run this command.
All good.
And then now would be a good idea to check
that we cancel SSH in a different terminal.
So let's open up a new one and we'll just,
I'm just going to do it in this tab quickly.
So we'll go ssh jonathan@psychotech.coza.
And there we go.
Okay, so that all still works, we're all good.
We've set up our firewall happy days.
I'm actually going to cancel this.
Okay, now we can close this one down.
Then the guide recommends fail to ban.
I don't disagree with that recommendation.
I'm not going to install that now,
but I do recommend going through the steps
of installing that.
And that's essentially the core sort of server setup.
So that's what's also covered in the initial setup guides
from DigitalOcean before we actually get
into the software we need.
So you'll see that took me about half an hour.
So yeah, it's just about half an hour to set up the server,
half an hour to set up the software,
and then about another half an hour to set up Windows.
So let's go ahead, I'm going to have a sip of coffee first,
and then let's dive into installing all the software
we need for the server.
(soft music)
Okay.
So the first thing we're going to need is nginx.
nginx is the server we're installing today,
the web server at least.
Now the folks at DigitalOcean,
they recommend using this packages maintained by,
and I apologize, I'm going to mispronounce this name,
but I'm pretty sure it's Andrej Suri.
It's basically a gentleman somewhere in Eastern Europe,
I think, who has these very cool packages for nginx, PHP,
and I think MySQL as well.
And it basically adds some additional things
on top of the default nginx.
So I do recommend using these.
He also has packages for Apache.
So you can do a similar process if you're doing Apache,
but basically you install the repository,
and then you run updates,
and then you can start installing software.
So I'm going to let that happen over there.
I'm also going to disable Grammarly.
Wait, what have I done here?
I'm going to disable Grammarly on my,
in this browser window,
because I don't need Grammarly to keep bothering us.
(soft music)
Go away, Grammarly.
Oh, good grief.
Okay, we need to switch it off.
There we go, switch it off over there.
There we go.
Side notes, I only discovered this much later,
but you can actually,
if you're working with spin up WP's command, copy things,
you can actually edit it if you want to.
So you could replace,
let's say you were working with something
like the previous command.
This is quite a cool little feature
that I really appreciated when I discovered it.
Let's say the SSH ones.
Let's say you wanted to put in your own stuff in here.
You can go like that and then copy and paste that.
I thought that's a pretty cool little feature.
What is this Google thing that's coming up here?
I don't know what that is.
Just go away.
Google Translate.
Let's just disable this.
Don't display.
Thank you.
Didn't even know that was enabled.
So yeah, that's just a cool little thing
that you can do there.
Right, sorry folks, little side note.
Okay, so we've installed the repository.
Now let's run update.
And these things always take a while.
So let's do a dist upgrade while we wait for all of it.
(soft music)
And this has happened to me
where I've installed the base server.
And then when I'm about to install the Nginx
and all that, there have been upgrades.
So it's always a good idea.
Pretty much anytime you're gonna install software
on a server, it's a good idea to run an upgrade.
Just to be on the safe side
and make sure you've got the latest
and greatest of everything.
Okay, then we could just go ahead and install Nginx.
So it's a simple command.
sudo apt install nginx -y.
The -y basically just automatically says yes
to any questions around do you wanna install these things?
If you don't put the -y and I'll show you what it does.
So it will ask you, do you want to install?
Do you wanna continue?
So all that does is -y for that.
So it just makes it one less step.
And once you've installed Nginx,
then you can run nginx -v.
And there you go, nginx is installed and running.
Now, if we go to our domain, we should see something.
So if we go to http colon,
did the,
psychrotech,
sorry, good grief, can I spell?
No, I can't.
P is my, there we go,
psychrotech.cozo.
We have an Nginx landing page.
So Nginx was successfully installed, happy days.
Okay, so let's get back to where we're going.
You'll notice it does make a point of saying
type in Http as opposed to Http
because we haven't set up an SSL certificate yet.
We'll see if there's time for that today.
I didn't have time last week.
Then there's a conversation around CPU calls
and all kinds of other things.
I'm not gonna worry about that now,
but it's a good thing to go through and break down.
But I'm not gonna worry too much about all of that.
And there's some server changes.
There's some client body backs,
client max body size stuff.
Read through all of this.
I'm not gonna do this today.
I just wanna focus on the core,
the core software and getting WordPress working.
Then we can install PHP 8.3.
So for this one, we need again, Andres,
I hope I'm pronouncing that name right.
Here's his repository for that.
And I do recommend reading through
and following all the things that I just skipped over.
We just don't have the time to go into it all today.
But there are some good tips and tricks
and performance improvements that are covered
in those previous steps.
Okay, so let's run an update again.
And then we can go ahead and install all the PHP goodness.
So for the purposes of this tutorial,
we're gonna run PHP 8.3 like they're recommending.
As some of you might know, WordPress, I think,
doesn't fully support PHP 8.3 yet.
I think WordPress core does,
but there are still plugins and themes that are out of date,
but we'll be fine because we're just installing
WordPress core today.
If you want to install a specific PHP version
like 8.2 or 8.1 using Andres packages, you can.
You can just replace 8.3 with all the 8.2 versions.
But I'm gonna go ahead and do 8.3 today
just because we want latest and greatest.
And then we want to configure PHP 8.3 and PHP FPM.
So it talks about configuring the user group
with the service we're running.
Basically PHP FPM is an alternative PHP farCGI
implementation with some additional features
that plays really well with Nginx.
And it is the recommended process manager to use
when installing PHP with Nginx.
So let's go into all the configurations.
It's not really much to do.
Takes a while to install all the software.
(laughs)
I'm just gonna let all of that go through.
Okay, so that's all done.
So what I like to do now is I like to make sure
that PHP is installed by creating a PHP info file
on the server.
So I'm pretty sure it's in the var
www.html folder.
There will be an index.injnxdb
and that's the one we see in the thing.
So I'm going to run nano index,
sorry, we call it info.php.
And I'm gonna just pop in a PHP info.
PHP info.
And you know for the longest time,
I thought you had to echo out that command,
that function, but it actually just echoes itself out.
(laughs)
So we'll write info.php,
permission denied, oh, I need to sudo.
Let's do this again.
We'll fix that in a second.
PHP info.
There we go.
And let's check if that works.
Yeah, didn't work.
Maybe 'cause I haven't configured it yet.
Okay, let's go through the steps
to get it all configured and working
and then we'll come back here.
So let's do this.
I thought it would just work, but I guess not.
Okay, so now we need to figure,
if I use a group, so there's user www.
So what I like to do here is I like to,
control + K will cut those lines.
And control + U will paste them essentially,
and then I like to paste them again.
So what I do is, and then I comment out the originals,
and then I can just update the new ones.
And I do this just in case I ever need to roll back
if anything goes wrong.
So we'll change this to my user.
Change that to my user.
Notice that this is really a sort of single user environment,
so I'm not gonna be creating multiple users
that need to access all the WordPress files.
So I'm just gonna set it up for this user.
And then we need to go for the Listen Owner.
There we go.
And again, I like to do the cut and paste thing
just to make sure I don't lose those.
I can always come back later and delete them
if I really don't want them there.
There we go.
All right, let's comment these out.
(upbeat music)
There we go.
And I think that's all I need to do.
I need to adjust the PHP I now to increase the upload size.
I'm not gonna worry about the upload sizes today.
But we can increase the client max body size
to match the engine X thing.
We can increase the post max size.
I'm not gonna worry about that.
I'm not gonna enable the up-catch file override stuff for now.
But all of this is recommended.
I'm just gonna keep it really, really simple.
So then I'm just gonna restart PHP FBM.
Every time.
Here we go.
And now it talks about confirming they're running
by doing that kind of thing.
I should be able to view my PHP file now
if I'm not mistaken.
So let's check that out.
No, still not.
Something's gone wrong somewhere.
Let's continue along here.
Oh, I need to create a separate site for it first.
Okay, let's do that.
So let's just go and rm rwwhtml,
input a PHP, let's remove that.
I need to do it as the pseudo user.
Okay, so now we need to create a default engine X site.
So let's do that.
So basically what it's doing is this is telling engine X
what the default site is when it requests information.
So that you can create the PHP file to view in the browser.
So then we find the section which controls PHP scripts,
pass PHP files to the CGI server.
Here we go, CGI server.
Change the section, so location PHP,
we need to sub-locure.
Location PHP includes snippets, all of that.
See, this is all commented out,
so we probably need to enable that.
So pass scripts to the file CGI server,
location PHP includes snippets.
Okay, we need that one.
We need that one, we need that one.
And then we need with PHP and most other sockets.
So we can actually comment out this whole,
section here,
there, and then we need to update those to run on PHP 8.3,
which is what we have installed.
If you install a different version of PHP,
you'd need to update that accordingly.
There we go.
Okay, so that looks correct.
And this is where it's easier for me to do this in Apache,
'cause I'm used to Apache, so I know how this works.
But I'm grateful for tutorials like this one,
which helped me do it myself.
So let's do that.
And then let's test that that configuration is correct.
This is something I learned recently
about testing your configuration files.
It's a very handy thing to do,
'cause you can check that it's all fine
before you try and restart configuration file test failed.
Oh, so you have to duplicate 962, see there's an error there.
So let's go and see if we can fix that.
All right.
I don't think we needed this,
I don't think we needed this one, that's why.
Yeah, I think that does it.
The other thing we probably also wanna do
is add PHP to this list,
which I'm guessing it'll talk about later,
but I'm gonna add it now while we're here.
So this just allows nginx to process PHP files
before index.html files.
So let's save this.
And let's run the test again.
Okay, so that test is successful, all good.
So if we copy and restart the server,
there we go, okay, now we can create the info file.
Okay, so sudo nano, could have just left it there.
This is also one of the things that I like
about Apache versus nginx,
and Apache it creates a virtual,
the first virtual host file for the default site for you.
So the default site just works,
you can just create the PHP file and test it.
Nginx, you have to configure it for PHP a little bit first.
But I mean, that's just, you know,
how servers are somehow different, sometimes different.
Okay, so let's do this one again.
PHP, PHP info, here we go.
And there's that, and now we're gonna just have to
own it by the users, so sudo, sh, own.
This is because we've set the user directive
the way we have.
So we got info.php.
Oh, full path, silly.
That one.
Okay, that's done, now it should work.
So let's make this nice and big,
and let's see if we have some success.
Bad gateway, great.
(soft music)
Did you hear that when things don't work
the way you expect them to?
I've seen this before.
Nginx, PHP, and gateway.
Yeah, it's client proxy request PHP,
PHP, PHP, PHP, first respond.
I think, I think, I think, I think,
I didn't restart PHP, PHP earlier.
Don't think I did that, let's do that.
So let's restart PHP, PHP, and let's restart Nginx.
Let's restart Nginx, sometimes that just fixes problems.
Just restarting everything.
Nope, ah, that's annoying.
Check your PHP log.
I was hoping we wouldn't hit any issues like this.
(soft music)
Let's see what we see in the error log.
Always good to know where the logs are.
Gonna see that.
(soft music)
Permission denied.
I wonder if that's because of the use of the mission thing.
Let's see if we change that back to
that.
We start that.
(soft music)
So this is where you watch me flounder, folks.
Gonna just run through this
and just check if there's something I've missed here.
Okay, they go into MySQL there.
Something PHP.
Make their domain, own it.
See, this one talks about setting up your domain.
So let's check that PHP.FPM is running.
No.
To M.
Yeah, PHP.FPM definitely looks like it's running.
Yeah, there it is.
Something in the configuration is not happy.
So let's go back a few steps.
Might be some of the things that I've skipped over, perhaps.
Don't think so.
(soft music)
See if nginx is still working.
Yeah, that's still working.
Where's the PHP that's the problem?
All right, let's just run through all the settings we made.
If it was any of those.
(soft music)
Okay, so let's have a look here.
(soft music)
Okay, version 8.3 is definitely installed.
(soft music)
Let's run this command and see what this is.
Yeah, it doesn't expect it to.
So it's the user and group.
Pheonix, user, group, that's fine.
(soft music)
And listen, own and listen group.
Yeah, that looks all good.
Okay, so that's all fine.
To increase the file maximum upload size,
that doesn't need to be done.
Postmax doesn't need to be done.
Enable up cache file overwriting.
That doesn't need to be done.
So therefore that doesn't need to be done.
Okay, so let's check this.
Must be in the, in here.
Don't need SSL.
Root is via www.html, that's fine.
Index, index.php, that's all fine.
Wonder if we need to give the server name a note.
I think that might be the problem.
Let's see.
That could be a problem.
That's probably fine.
Let's have a look at this.
So that's location.
Bring this side by side.
Where are we?
So that's location, PHP includes snippets,
passai.php.conf, passai, passie, index, brand, PHP,
PHP 8.3, FBA, and MOSOC.
That all looks correct.
Wonder if this was the problem.
Let's see.
Okay.
(upbeat music)
That's done.
Where's the info.php?
It's only by the WData user, okay?
So let's change that back to, let's just see here.
I should see if that fixed it.
No.
(upbeat music)
Okay.
No.
That's a little bit annoying.
(upbeat music)
So what I'm gonna do now is I'm gonna kind of just jump
ahead and continue with this tutorial
because I'm pretty sure there's something that's missing
in the configuration.
And I set up a special site for it, it might actually just
work.
So I'm gonna go ahead and jump ahead here.
Create a specific site and see if I can get that working.
So before I do that, let's install MySQL.
I'll come back to this in a bit.
(upbeat music)
That's a good point actually.
I didn't enable the sites, but this was the default site.
Let's just see here.
I think,
I think we, sites available.
Let's have a look at sites enabled.
That's actually a valid point.
Let's have a look at that.
So let's see.
(upbeat music)
Sites enabled.
Defaults already enabled.
So that means that's what's serving everything
to the default route.
So don't think it's that.
But I'm gonna see later on if we set up a specific site
folder, which I think this tutorial does do for us.
I think then we might find it works.
It's the default site that's a bit 1 kilo right now.
So I'm gonna come back to this.
Okay, so let's get on with MySQL.
I'm not gonna let this deter me.
I'm just gonna continue on ahead.
Okay, so they set up MySQL.
And then we want to alter routes at localhost
identified by password.
And I'm just gonna literally leave that like out for now.
If you guys wanna bomb the server, you're welcome to,
but I'm gonna cancel it in a second anyway.
Obviously you wanna change the password
to something more secure on your side.
I'm just gonna make a password.
And then we can exit out of there.
And then we can run the secure installation.
And this will ask us to do another password,
which I'll just make one up as we go.
Okay, so we want to go to the routing user.
So that's password.
I'll just move my mic out the way.
Sorry folks.
And it says, do you want to yes?
Okay.
Too strong.
(soft music)
Yes.
And then let's go with the new password.
(soft music)
Oh, this is gonna match.
This is 'cause I'm trying to type it from memory.
(soft music)
Do you want to yes or do?
Remove anonymous users.
Yes.
Disallow root login remotely.
I think I need to disable that.
Should only be allowed from localhost.
So yes, I want to disable remote users.
And I even, if you tried to log into the server remotely,
you wouldn't be able to.
Let's run the test database.
And let's reload all the privileges.
Okay, so that's all done.
So now we've got all the software installed.
We don't quite know if we have PHP working yet,
but I feel like it probably is.
There's probably just something with the default site.
We'll see when we set up the first WordPress site.
But that took about an hour.
So it's about an hour, give or take,
to kind of get the server up and running.
Let's jump ahead to our next setup.
I might not do HTTPS.
I'm not sure.
I don't know.
I think it's pretty quick.
But it does take a while.
So I'm gonna skip over the HTTPS stuff.
I'm not gonna worry about that now.
You need to set up C names and all kinds of other things.
I'm not gonna worry about that now.
Good steps to go through.
They use Let's Encrypt.
So it's a free SSL search, so it's recommended.
And then you set up the server to run and all of that.
Okay, so now we need to set up the server block.
Oh, we need to set up,
okay, we're gonna need to set up the certificates.
For this.
Okay, so I've already got the DNS set up,
so I'm gonna go ahead and set up a certificate.
And the reason I'm gonna do that is because
the setup instructions are gonna require the certificate.
So it's a good thing to do.
No, no, sorry, wrong command.
How do I?
No, I want this one.
So let's copy this.
And then let's add this one.
(soft music)
And then update again.
Hmm.
And then we can install a set button with that.
Okay.
So we can install it.
And then, delete the department stack.
And then while that's installing,
I'm going to configure the command here
so it works for my my domain.
So it's going to be,
paste my goro to your gate.
And,
www.
Oh wait,
smigoro
Okay, that's it today.
I love the fact that you can do that.
Okay, so if we paste that,
into email address,
so I'm gonna put it in my email address.
There we go.
And it's gonna do things and ask me to confirm things.
So yes, I'm happy with that.
Yeah, that's all fine.
So it requests a certificate.
I need to make sure where the certificate file are created
'cause we need them for later.
So there they are there.
So I'm gonna copy this out
and pop it into a note.
So I do recommend doing this on servers.
You can either do a free Let's Encrypt certificate
or you can purchase your own certificate.
But if you don't want to purchase one,
a free certificate for a WordPress site is fine.
Okay, so now let's create,
so this was created the catchall.
So let's go through and do all of this.
Okay.
So let's make all the files,
the directories we need.
So this is basically creating a folder for the logs.
I'm trying to call it a psychrotick 'cause it's easier.
(soft music)
And this will be the public directory.
That's not what I wanted.
No, that's not what I wanted either.
This is what I wanted.
There we go.
And then that there.
Okay, so let's create the directories.
(soft music)
Okay, so if we,
unless we've now got the psychrotick directory,
which is great.
And then we want to set up the missions.
Okay, that's done.
Now we're going to go into sites available
and create the virtual host for the site.
So it'll be pseudo nano in our case, psychrotick.
And then copy and paste the following
configuration ensuring that you change
server name, access log, error log and route.
So I'm going to copy this whole thing.
I'm going to pop it in here.
Okay, so server name is
tech.cosa, SSL certificate.
Here's this one.
(soft music)
We'll change pair that one.
(soft music)
Be interesting to compare this to the default catchall
and see why it went wrong,
but I'm not going to worry about it now.
Okay, so that's the whole chain.
This is the private key.
The process of this is very similar in Apache
if you're doing an Apache system,
you just need to Google how it all works.
But it's basically setting up the security thing,
the certificates in the right place
and taking it from there.
So it's home, Jonathan, psychrotick.
(soft music)
Okay, RO.
(soft music)
Okay.
This is the public route.
Okay, that's fine.
That's fine, that's fine.
That's fine, that's fine, that's fine.
This is slightly different.
So that might be how we fix that.
So let's see.
So this is now today.
Oh, this is the same stuff here.
Let's copy that out.
(soft music)
I can find the thing now.
(soft music)
Okay, so that's good.
And we wanna return 301 to psychrotick.cos there.
It's basically just gonna handle any request
to the www subdomain.
There we go.
And then this is setting up everything from to port 80,
which is basically anything that's insecure.
(soft music)
Normally what I would do is I would copy that command out
and do like a search replace,
but I'm letting you see the real time.
PSYKRO, TK.Z.
Okay, so that handles everything on port 80.
Basically it points it to HTTPS version.
That handles everything on the HTTPS,
but requesting the www subdomain.
So that should all be fine.
And then this handles all the confine configurations.
And that points to the root.
And that should all be fine.
Okay.
So now that we've done that, we should be able to save this.
Just goes. (laughs)
And now we need to tell it to load.
So we copy, let's just actually do this here.
PSYKRO, TK.
Two sites enabled.
And this is another thing I like about Apache.
Apache just go,
A2B and sites and the site name,
and then it just creates the similar link for you.
But that's fine.
We'll do it the engine X way.
So let's paste that.
Okay.
So we need to check that it's all fine.
(soft music)
Honestly, the configuration files
is probably the most difficult part of all of this.
And I still to this day don't fully understand
what they all do.
I just rely on online tutorials. (laughs)
I'm a developer, not a sysadmin.
Okay, so let's restart Apache.
So now I want to see what happens if we browse
to just the pycrotict domain name.
Probably we'll get some kind of, getting the,
okay, that's probably because the default one is set up.
So what I want to do is find that default config file.
No, I wouldn't do this one.
I don't want to go to sites available.
Sites available.
I just had a thought, just give me one second.
I wonder if this was breaking
because I was requesting on the domain name
and I hadn't set that up.
So let's just go back here.
Don't think this is going to work,
but I'm just going to revert this back to that.
(upbeat music)
And then I'm going to restart nginx.
Go to the database in a second.
And then I'm going to grab the domain.
This should break, that's what I wanted.
That should give me nginx.
That's looking me a bad gateway.
Okay, I'm not going to worry about that now.
But now if I come to here,
this is going to give me an error, which is fine.
So now what I want to do, just for my own purposes,
I'm going to go into public and I want to go HTML.
Okay, and then this should give me hello.
Right, it's probably not going to give me hello.
Oh wait.
This is because
(upbeat music)
the index.php file.
Okay, that's fine.
Let's just leave it like I forgot.
I'm just going to continue ahead
and hope it all works out.
And if we have to, we'll do some troubleshooting
at some later stage.
So for now, let's install a database.
(upbeat music)
Okay, and then let's create database.pswc.
Okay.
Okay, that's created.
Create a new user so that we can identify it.
So let's copy this.
And this one I'm going to have to ask you folks
not to mess with my user.
Because, okay, so let's just take this over here.
You shouldn't be able to access it
until I install the WordPress site,
but please I mess with it when we're doing it.
So let's go create, create user.
(upbeat music)
Psychrotech@localhost.
Identify by, and let's just go like that.
That might work.
(upbeat music)
We've got to get it,
we've got to generate to say secure password gets,
let's do that.
Just generate.
Let's just use that.
I have to do a little over again.
(sighs)
This was the most difficult part of creating things like this,
is creating passwords.
Okay, let's copy that one.
Oh, good grief.
And password is not playing with me today.
(upbeat music)
There we go, okay, let's copy this one out.
Just doing this little screen, my notes,
so that I can see what I'm doing.
No, I want this one first.
(upbeat music)
Okay, let's do it again.
Okay, let's do this one.
There we go.
Your password, oh.
Oh dear, oh dear, oh dear.
(upbeat music)
When you've set the password requirements too high.
(laughs)
Dear, okay, let's just do a Google search.
Generate my SQL password that meets strong,
so I didn't spell meets correctly there.
There we go, there's a password generator.
I'll just use this one.
Let's try that.
Okay, that was happy.
So that's that one done.
And then we wanna grant all privileges to that user,
so that user can create databases.
(upbeat music)
Anybody who's watching this on YouTube later,
I'm gonna nuke this server anyway,
so you can't use that password.
Okay, we don't need to worry about the more granular control.
We wanna flush the privileges.
Here we go, and then we can exit MySQL.
All right, now we wanna install WordPress.
I should have installed WPCLI, so let's do that quickly,
'cause that was just making installing WordPress easier.
So we can just copy this one.
Okay, and then we can move it to somewhere we need it.
So this is handy for WordPress specific stuff
to install sites and all that kind of thing.
There we go, post that.
Okay, so if we just go WP info.
Yeah, no WordPress installation found, that's fine.
That's dash dash info, I think.
Okay, there we go.
(laughs)
Elaine, what are you doing around here?
I forgot that I needed that.
So if anybody's interested to know,
the gentleman who just commented in the chat
is the maintainer of WPCLI.
I thought I could skip over installing it,
but I'm gonna need it for my installation, so welcome.
Okay, now let's get on to setting up WordPress.
And I still need to figure out this engine X issue,
but we'll see how it goes.
Done a lot of that, done a lot of that database we've done.
Okay, let's install some WordPress.
So we can go to CD,
cyclotec public directory.
We can remove the index.html file.
And we can go WP core download.
And there it's downloading.
And then we can create the config file.
So I'm going to just do this inline here for now.
I'll do a DB name, psmykroutk, DB user, psmykroutk,
DB pass, password.
Honestly, if you are managing WordPress sites on a server,
WPCLI is the best way to do it.
I have WPCLI installed for my local environments.
Highly recommended.
There we go, config file generated.
Now we can run all of this, so let's go.
(soft music)
psmykroutk, let's see what it's today.
Okay.
I'm just going to go J passenger.
And an email will be Jonathan@psmykroutk.
Let's see what it's today.
If I had my password,
I'm just going to put in a password for now.
If you guys want to log into the site
and break it your motherfucker
or kill it after the livestream.
It's up to me to go.
Password one, I'll easy here.
There we go.
Okay.
So that's all done.
So now let's see what happens if we go over here.
Okay, I'm still getting issues with this.
I don't know what is going on here.
(mumbles)
This is annoying me.
Something in the nginx configuration
or something is causing this problem.
I don't know what it is.
So it happens if I can look for the read me for example.
It's going to be really annoying
if I can't get this to work before we finish up here.
Okay.
Just do an empty cache and hard reload.
No, it doesn't like that.
I'm going to try the dumbest of solutions
and just try and restart the server and see what happens.
Okay.
(mellow music)
Now I can't connect the damn thing.
(laughs)
Oh dear, did I break it?
It looks like it's running.
Okay, it's up and running again.
See what happens here.
Still for a point.
Now why is that?
Okay, let's see what I can figure out here.
Permission denied, permission denied.
It's got to do with use of permissions.
(mellow music)
It's got something to do with user permissions.
Can I set those up when we configure Nginx?
Oh wait.
Wonder if this is the problem.
(mellow music)
Wonder if there's something that I missed.
Yeah, that, ah.
So when I skipped over the worker processes and all of that,
there was also a thing about setting the user to the username.
That's what I missed.
Ah.
Sometimes, sometimes you can't skip over steps.
But I didn't really want to go into the old issue
of doing all of that.
So let's fix that.
That'll probably fix the other issue as well.
This was the problem, bitchy.
Okay.
Now I'm gonna chat about this in a second when we wrap up.
Just wanna commit this out.
The rest of what I div as is.
Okay.
So that's that done.
And then we probably just need to restart Nginx.
Don't need the client max by stuff.
Let's just check this.
That's all fine.
Should we start this?
Okay.
Let's see what's happening here.
Yay, it did work.
Okay.
So let's talk about this for a second.
One of the things that the spinup.wp guide tells you to do
in this example is to change the Nginx user
to the user that you created.
Now that's fine if you're gonna create the server
to host one WordPress site.
It's actually, we should be able to see our WordPress site.
There's the readme, for example.
And there's the WordPress site.
It works.
It's login.
What we said was Jonathan and what was it?
What did I make it?
Can anybody remember?
Password one.
No, it was J. Passenger.
Password one.
Maybe not.
Maybe I changed it to something else.
Oh, there we go.
Logging in.
So you're welcome to log in.
I'm gonna nuke the server after this livestream
as soon as this finishes,
but feel free to log in and play around if you'd like.
Leave me a homepage.
So this is interesting.
So as I was saying, this guide tells you to set up
the Nginx user as the Jonathan user,
or in our case, the user we created.
So basically that user is managing the whole server,
is managing the site running on that server.
And you need to make sure that that user's set everywhere.
If you're gonna be running some kind of like
shared hosting environment,
you kind of need to have like a top level admin user.
And then I think you can add a per site level.
You can create different users, different user folders,
and then you can do things like FTP access
and all that kind of thing.
But this is like the safer way of just having like one user
that manages the whole of Nginx.
So that was, in case you missed that,
that was in the Nginx config file.
So the etc Nginx config,
we just changed in that user to the current user.
And then later on,
we changed the ownership of that Cycrotech folder
to that user.
And that's why it all magically works.
Okay, we have 20 minutes left.
Let's see if we can get this thing to WordPress multisite,
because that was kind of what we did talk about
in the original meetup, I think I said.
No, no, I didn't talk about multisite,
but it's something that I was asked about,
like setting up multisite on Nginx.
So let's see if in 20 minutes,
whether we can do that quickly.
So WordPress multisite.
Let's see if we can enable that quickly on Nginx.
Create the network.
We need to allow multisite to be true.
So let's go in there.
Let's go to CD,
SnikerTech, public,
WP config.
No.
Oh wait, changing directory, not nanoming, sorry.
Hit the right button for crying out loud.
(laughs)
Go.
Let's just pop this in here.
Okay, and now we should be able to refresh the dashboard.
I think it's in tools, we've got network setup, there we go.
I'm gonna go with subdomains.
I've got a wildcard subdomain setup on my DNS already,
so that's fine.
Let's go install.
Okay, and it says now the other thing to note
is compared to Apache,
there's some further configuration
you need to do for Nginx.
So I'm gonna first make these changes here
to the WP config.
Okay, so that's all there,
and then let's go and have a look
at the further configuration.
And this is where, because you're running Nginx,
you need to be able to set certain things in the config.
But I got a feeling that the spinupWP config
actually allows it to just work.
So let's see if it works without anything to do anything.
And let's see what happens.
Okay.
Let's go.
Okay, and it was passed.
This word, one.
Okay, we're in, don't need that.
It looks like we don't have sites yet.
Existing network is good.
All right, no.
Let's do this again.
Just, oh, I haven't saved this, that's why.
Silly boy.
Let's do that again.
Okay, let's log in.
What was it?
Jonathan, yes, this word, one.
Was it not, what was it?
I can't remember.
Tape passenger, that's what it was.
One password is freaking out.
Wait.
Okay, yay, we have sites.
We have network admin, we can create sites.
Let's see if this all works.
So let's add a new site.
Let's call it Bob, Bob's site.
We go Bob@psychrotick.clo.cda.
We add a site there.
See if that works.
Let's see if we can visit the dashboard for that site.
Yeah, that's fine.
That's because I think the SSL certificate
is not set up correctly.
But I think that can be fixed.
I'm not gonna do it now,
but I'm pretty sure it can be fixed.
But there's the site, and we can view the sites.
Yay, the site works.
And so this is another reason why I recommend
following the spinup WP guide,
because the Nginx configuration that they have,
that they described in the per WordPress sites block.
So, this whole thing here is set up
so that it supports multi-sites as well.
So if you wanna do a multi-site installation,
you can do that, and you're good to go.
I'm going to turn off the server now
so that you people can't log in if you want to.
But essentially, that's how it all works.
I went through that all very quickly,
but you're looking at about,
once you're comfortable with the settings,
once you go through the process,
you're looking at about two to three hours max.
As we discovered, there were some steps
that I sort of skipped over
that required me to do some things,
specifically changing the username,
or at least the name that the server's running under.
All of those steps that I skipped over,
I do recommend going through them and setting them up,
because the folks of spinup WP have done a great job
of sort of finding the best connections
and the best setups.
So I do recommend going through that whole process.
Would have taken us longer if we did that,
but there you go.
But there's our network working,
there's our site working, you can't access it now
'cause I've just disabled the server.
Let's just verify that.
Yeah, it's all dead.
(laughs)
But yeah, so that's our fairly,
I mean, I say fairly straightforward.
I'm fairly comfortable on the terminal,
I have set up these things in the past,
but it is definitely possible
to create a WordPress site on a VPS.
You're looking at, on DigitalOcean,
I think this VPS is something like $6 a month.
So $6 a month and around about two to three hours
of setup and configuration,
and you've got a working WordPress site.
So if you're looking for something to manage yourself,
I recommend checking it out.
I even suggest to developers
that even if they don't ever plan on using this stuff,
it's a good idea to go through the process,
understand how it works,
understand what the different commands do
so that you know what it's doing, read up about,
what am I changing, what am I doing?
Let me switch the server back on so we can see it.
Because it's a good thing to know how these things work.
I've broken it completely now, you watch.
(laughs)
Does this work?
No, that's dead as well.
It's probably gonna take a while before it comes up again.
Um.
Let me see if I can log in here.
Do, do, do, do, do, do.
Let's log back in.
Wonder why, it's interesting.
It takes so much longer to restart
once you've got all the software installed on it.
Do you find that interesting?
But this should all be working again now.
Yep, there we go, it's all still running.
So that's the other nice thing is you can turn it on
and off if you want to.
You know, you can do pretty much whatever you want.
All right, folks.
So that certainly wasn't a step-by-step guide.
It was just, you know, the process of doing it.
There is going to be a third edition of this livestream.
And so far, each livestream has had some kind of issue
that I've had to figure out,
so hopefully the third one doesn't.
But essentially this all comes from a question
that I had about somebody asking me to set up a VPS
with multi-site support using open light speed.
So that will be the next livestream around this topic.
We'll see if we can get open light speed set up.
And then maybe I'll try and document all the links
and the steps and the whatever else.
But anyway, my recommendations, as I say,
check out the DigitalOcean initial service set up
with Ubuntu, check out the how to install the software
on DigitalOcean, also go through the SpinupWP guide,
three great resources that I highly recommend you check out.
And play with it yourself.
Try and find some kind of virtual local server if you can,
something like DropBox, not DropBox,
VirtualBox or something like that.
And then you can play with these things yourself
and you can kind of understand how all these things work.
I highly recommend that developers understand
how the web server that they work on works.
It's a really good thing to do
'cause you just understand how things work better.
And you just have more knowledge about, you know,
your space and what you're doing.
Okay, that's gonna be my bit folks.
Thank you everyone for joining.
Thank you all for your comments and your chatting.
Thank you for my guests who suddenly joined me
out of nowhere, but I didn't know we were joining.
But I hope you all have a great rest of your Tuesday
and rest of your week.
And I will see you again in around about a month
when we dive into open mitespeed
and try to get that set up.
Okay, bye.
(soft music)