So the first thing we to make sure is running is Mongo.
So, just type sudo systemctl start mongodb
and we can confirm that it's running by going to localhost:27017
and we'll get this message, and that basically means
that it's
working and running.
So what we need to do is create our user for
our database that our app is going to use.
So our application is gonna use a database will create
called
app.
So what we need to do is connect it to the Mongo shell to create a user
for that.
So, just type mongo
and it's gonna take you in, it's gotta automatically
connect you to a test database.
We need to be using our database so type use
and the name of our database
and now we're gonna create our user so to do that type
db.createUser,
that's a capital U in User.
Open up brackets
and inside that, some curly brackets and then type
name
ang then quotations, your username
coma pwd
and then the password you're gonna use
and then roles
and in here you need to open up square brackets
and inside that some curly brackets,
type role
and in here type readWrite
as the value.
W in Write is capitalized
and then db and then the name of the db.
So it should look like this,
make sure your syntax is correct.
It's very easy to miss comas or
brackets
when you're working in the Mongo shell.
When you're ready just hit enter
and it should create a user and it should tell
you that it successfully created the user.
For me it gives me an error because I've already got
that user created.
So now we can exit in here
and we're back into our shell.
So now we need to configure Apache.
Actually first let me,
we need to do one more thing with mongo so type sudo nano /etc/mongodb.conf,
we've gotta turn
authorization or authentication on here so just
come down to this line this is auth = true
and just remove the # symbol.
Ctrl o to save, ctrl x
to exit.
Now we're gonna restart
mongodb so
systemctl restart mongodb.
Good stuff.
Now we've got to configure Apache and this is gonna be the,
the point of of the video I guess
is this is
and advanced configuration of what you can do with
with Apache
and it's not gonna be all in composing.
You may need to use
some different modules or
you know, with Apache
than what you need with meteor.
If you're
deploying a meteor app this should work flawlessly for you
but this, gives you an idea of
the fact that there are different modules that you can enable and disable
in Apache if you need them.
So, we need to enable three
modules for Apache
to handle the proxy because we're gonna be running our app
on port 58080
but we don't want users to have to
you know
remember the port number and we definitely don't want the port number visible
in the URL
and so this is what we need to configure
for Apache.
So, to do this
type sudo a2enmod proxy
and then sudo a2enmod proxy_html
and then sudo a2enmode proxy_http.
Now once you've got this done we actually need to create
the virtual host
and so what a virtual host is,
is let's say you wanna run
you know, 6 different websites
in their own directories
at 6 different domain names so let's say you have 6 domain names pointing
to this or actually let's say you've got one domain name pointing to this server
but you wanna use sub domains which is
the portion for the domains. You can have like app.yourdomain.com,
app2.yourdomain.com and here's how you would set up
those.
So what we need to do is go into
etc/apache2
and here you can see that we've got a sites available
directory
and we're gonna create a file in there so just type sudo
./sites-available
and I'm just gonna call that app.conf.