How to Host a FREE Website on Google Cloud Platform
hey everyone this is tony teaches tech
i'm tony and in this video i'm going to
show you how to set up a wordpress
website
on the google cloud platform for free
that's right free hosting
free storage space and free bandwidth
every single month restrictions apply
i'll get into those in the video but the
point here is that you can get started
with the google cloud platform
without spending a dime now i'll be the
first to admit that the restrictions
we're working with are pretty tight
the server is going to have less than
one gigabyte of ram about 30 gigabytes
of
storage space and one gigabyte of
monthly
transfer but as long as you stay within
those restrictions your website
is literally free forever so let's go
ahead
and take a look at how we do this i have
already signed up for my google cloud
platform account and i'm logged in at
console.cloud.google.com up here as you
can see
and what we want to do is click on the
navigation menu on the left and go
down to the compute engine in here we
want to create a virtual
machine instance a vm instance so go
ahead and click on create
and you can call your instance whatever
you want i'm going to call mine
wordpress test okay now here is where
some of those restrictions are going to
take place as we define
our server i'll put something up on the
screen here that will
that we can reference as we build our
server so basically the region we are
allowed to be in
is either oregon iowa or south carolina
so we have iowa selected here that is
fine for now and you can pick whatever
zone you want within iowa
i'll stick with the default a now as far
as the machine configuration we want to
make sure that we're picking
the n1 first generation which is an
intel skylike cpu
so make sure you select that and we'll
go ahead and expand these details
right now please ignore these pricings
this is going to be
we're going to get this down to zero
dollars well technically around five
dollars per month but
that's going to be absolutely free for
you now the next thing you want to
change
is the machine type this one we want the
f1
micro instance which as i referenced
earlier it
is 614 megabytes of memory less than a
gigabyte of ram
that's okay go ahead and pick that we
are down to 4.28 cents per month
let's go change our
uh operating system and our disk
drive our disk space so we can do that
in here
and i'm gonna pick ubuntu you can pick
any of these without
um i think without any extra charge so
i'm gonna pick ubuntu
and the version i'm gonna select is
ubuntu 20.04
lts for long term support and as you can
still see on the screen here
the size the max size that you can have
here is 30 gigabytes so let's go ahead
and take advantage of that
select that to apply the changes and now
up here
our total is five dollars and eight
cents per month
but you can see here that your first 744
hours
of this instance usage are free this
month and so
what does that mean 744 hours well if
you do
uh 31 days in a month times 24 hours in
a day
you'll see that equals 744 hours which
means
essentially this is 100 free
you're not going to be charged anything
for creating this instance
now the only other thing we want to do
on this page
is to make sure that we allow http and
https
traffic but other than that we're good
to go so let's go ahead and create this
virtual machine and this will take
i've seen anywhere from 20 seconds up to
a couple minutes so
instead of wasting your time i'm going
to pause the video and i'll get back
with you when it finishes all right guys
in about 15 seconds later we're good to
go our instance has been created
as you can see here wordpress test
within the iowa zone
and it has this external ip address
that's listed here now this is the point
in the tutorial where if you do want to
associate a domain name
with this server we're going to go ahead
and do that if not you can go ahead and
skip through this part
what i'm going to do is copy this ip
address this external ip address
and go to the place where i bought my
domain name which is dreamhost
and this will work anywhere where you
get your domain name the same concept
will apply
all you have to really do is come into
your dns settings
and create an a record for your ip
address
so the the type is the type of the
record is a
and the value is going to be the ip
address so we'll go ahead and add that
record
and there's one more record that we want
to add and that's going to be for the
www version of our website so
www.tonyflorida.me that's the domain
name that we're working with let's add
that record as well
and this takes some time to propagate so
it's a good thing we're doing this
at this point in the tutorial now we
have two
a records for our domain name
tonyflorida.me
one for just tonyflorida.me and one for
www.tonyflorida.me
both pointing to the ip address of our
server
okay now that that's out of the way
let's go back over to the google cloud
platform
and log into our server via ssh now
typically you would do this with either
the gcloud command i'll have a video on
that
or you could use your terminal window or
putty if you're using
a windows computer but because we don't
know the root password yet
we have to do it in a web browser and
it's really cool they have it set up for
you where you could just click on that
and this will go ahead and transfer your
ssh keys to the vm which is
a secure way of connecting to the
virtual machine
again this will take just anywhere from
30 seconds to
a couple of minutes to start up so i'll
pause the video here and catch up with
you when it finishes
all right guys we're in we are logged
into the remote server via ssh
and as you can see here we are running
ubuntu 28.04 which is the operating
system that we
picked when we created this virtual
instance now the first thing we want to
do before we go ahead
and install wordpress and all the
dependencies is to update our system
and we can do that with sudo apt-get
update and sudo apt-get
upgrade so go ahead and execute that
command
by the way all of these commands in this
tutorial will be linked in the
description below
so you can copy and paste them instead
of typing them from the screen
they will be on my blog at
tonyteaches.tech so check those out
when this is finished i'm going to hit y
to continue when this is finished i'll
catch back up with you
all right our system is up to date that
has finished and the next thing we want
to do
is to install a web server we're going
to be using nginx
a database we're going to be using maria
database which is a mysql database
and php all of which are necessary for
wordpress to run
so let's go ahead and do that with this
command here apt-get install nginx maria
database server phpfpm
and phpmysql so hit enter
and this will take a little bit longer
it's 199 megabytes of space
same thing as before i will pause the
video catch back up to you when it
finishes
okay now that we have all that software
installed let's check what version
we have for php and that is 7.4
we'll use this a little bit later and
let's check our mysql version like i
said we're using
maria database and that is version 15.1
now let's work on our database okay
first let's secure a database within
mysql secure installation command
and this is asking us for our current
root password we don't have one
but we do want to set one so type y and
go ahead and type a password and confirm
that password
and pretty much for the rest of this we
will type in y
to accept the defaults and this again is
securing
our mysql database installation
now that we have that all set up we can
go ahead
and log into our mysql server with sudo
mic sql dash u
for user root p for password type in the
password that you just created
and now we are we have a my sequel
console
and what we want to do is to create a
database for our wordpress website
again all of these commands will be
available on my website which is linked
below
first thing i want to do is to create a
database called
example underscore db and then we want
to create a user
with a password with create user
his name is going to be example username
and he is going to
you have a password that is example
underscore password
in reality you're going to want to make
these uh more secure
and suiting to your needs as far as the
names and the passwords are concerned
anyway let's grant all privileges on the
database
to this user as long as he's on this
local host so execute that and then
finally we want to flush the privileges
which is essentially
applying our changes and then we can
exit out of our
mysql command prompt now let's go
into the var www directory
and in here is the default place for
websites all the website files are
usually living under
here as you can see there's an html
directory we're going to go ahead and
make our wordpress website in a
directory under here called wordpress so
let's go to the official wordpress
website we're going to use the wget
command
to download the latest version of
wordpress as
in archive so execute that command here
and once we have that we can go ahead
and extract its code right now it's just
going to be
a tar file which is basically like a zip
file
we can extract that with pseudo tar zx
vf the name of the archive
and then finally we want to remove
that tar file because we don't need it
anymore so we can do that with rm
latest.tar.gz so now we have that
wordpress directory
we want to change the owner of this
wordpress directory to the
www data user in the www data group
that's what this syntax does right here
we're going to do that recursively for
everything inside of the wordpress
directory so
go ahead and execute that now that's all
we need to do for wordpress so far let's
just take a peek inside of here
we have all of these php files
and other configuration files that are
necessary for
wordpress to run default out of the box
so
let's go ahead and move on and work on
our web server
again that we're going to be using nginx
so we can go into the etc
nginx directory and in here we have a
few directories and
configuration files but we're going to
be working out of the sites available
directory
and in here we have our default
configuration file
we're going to actually make a new
configuration file i'm going to call
mayan
tonyflorida.me.com and
it's just usually the name of your
domain name followed by
dot conf and i'm going to be using the
vim text editor if you don't know how to
use that i'll have a video
about how to use that or you can use a
different text editor to edit this file
so
what i'm going to do is copy in the
configuration file content and paste
that in
and this is a little overwhelming for a
lot of people but let's just go through
it real quick
we're going to be listening on port 80
which is the default http port
we have our server name which is my
domain name and the www
version of the domain name which you saw
earlier we already set up those dnsa
records to point to this ip address
so that's all linked up our wordpress
website exists
at this directory on our file system
and our index of our website the first
the home page
uh file is called index.php now the only
other thing i want to point out here
is that we are using php version 7.4
like we checked earlier so that's why we
have this referenced up here
okay so let's go ahead and save that
file
and in order for those changes to be
visible
we have to sim link from the sites
available directory our configuration
file that we just created
to the site's enabled directory and we
can do that with the ln
s command so that looks good and finally
let's restart our nginx web server with
system ctl restart
nginx and we didn't get any
output no errors or anything like that
so i think we're good to go
let's go ahead and get out of this
console window for now
open up a new tab and go to tony
florida dot me
and this is great this is the
installation for wordpress
it's reading our system are i
it's basically has gone to the ip
address looked to the dns lookup
and is now serving the files from the
var
www wordpress directory so let's go
ahead and go through this installation
we can click
continue for english we have all of this
information so let's go ahead and set
everything up
what we're doing here is we're
connecting wordpress to the database
that we created so
the name of our database is called
example underscore db
our username is wordpress
wordpress username our password is
wordpress
password and uh no i'm sorry it's
example password
and example username i got that wrong
and our database host is localhost
that's fine and you can change the table
of prefix to whatever you want let's go
ahead and submit this
and this looks good all right sparky
you've made it through this part of the
installation
it can communicate with your database
let's run the installation
and this is where we're going to define
our website so what's the title of our
website i'm just going to call it
tony florida my username for
logging into wordpress i'll say is tony
florida
and this looks like a good password i'll
copy that onto my clipboard
and my email tony at tony teaches
dot tech okay so let's go ahead and
install wordpress
and just a couple seconds later we're
good to go let's log
into wordpress username again tony
florida password i can paste that from
my clipboard click that remember me
and log in this is the wordpress admin
dashboard this is where you write posts
you can come in here and write a post a
new blog post
and they already have a hello world blog
post in there but uh
that's fine we'll just say welcome
to google cloud platform
we did it something like that so we'll
publish our first blog post here
and that will be available let's view
the post
here's our first blog post not much
there and you know if we go to our home
page here this is what that looks like
there's a lot of configuration that you
can do here as far as
the appearance adding some plugins all
that stuff
i have plenty of other videos on this
channel so check some of those out
but the one thing i do want to say here
is that
the i want to talk a little bit more
about the pricing so
as far as this is concerned if you don't
go above one gigabyte
per month of transfer out of your server
if you don't serve
more than one gigabyte of pages then you
won't pay a single cent for this website
but if you do go above that threshold
then you will be charged
12 cents per gigabyte okay i'll make
i'll have a whole other video on this
topic which you can check out here
if you want to go more in depth with
that i just want you guys to be aware of
that and then also if you want to
install an ssl certificate on your
wordpress website check out this video
here thank you guys for watching i'll
see you in the next video
you
Hosting a website from your computer without a web hosting services
Comments
Post a Comment