Many tutorials will teach you how to set up Magento on a server, but if you don’t know what a server is those tutorials might not be that helpful. This tutorial is for people who are running their own small business and are either: selling on Etsy/Amazon/eBay or wanting to start selling online but unsure of where to start. You do not need to know how to code for this tutorial, but you will need to be able to read error messages and keep good documentation. To have an online store, we need a few things:
- A place on the internet for your site to live (your server)
- A way for other people to get to your website (a web address)
- eCommerce software (this is where Magento 2 comes in)
- A few other things (marketing, order management, etc)
This document will guide through the entire progress, and by the end of it, you’ll have an eCommerce site that is one-hundred percent yours. This will cover the first two items on the list.
Our first step is going to be to find a home for our new website. There are dozens of hosting options that you can use. Digital Ocean is one recommended resource, but we will be using AWS because you can set up many of your services under one account, which makes accounting much easier. AWS is Amazon Web Services which hosts a huge array of services. We are going to focus on four services: Lightsail, Route 53, billing and cost management, and key management service. Let’s get our server set up:
- Make an AWS account
- Login to your management console
- Click services near the top of the page, and under the compute section click on Lightsail, you’ll be taken to a new page
Now you will create an instance-click the create instance button, these directions go in order with the options that are presented.
- On the select a platform choose Linux/Unix
- On the select a blueprint select Plesk Hosting Stack on Ubuntu
- Don’t worry about the launch script.
- The key pair is an important step! Keys are how we will be able to get into our server. Click create new and give it a name. When it asks you to download the key, make sure you save it somewhere safe. If you lose the key, you won’t be able to get into your server.
- Automatic snapshots are a cool feature, but not needed as you will be setting up backups later.
- For your instance plan, either the 20-40 dollar plan is good for most businesses, but I have gotten it to work on the 5 dollar plan.
- Identify your instance- give it a name (probably your website name, but besides organizing billing, this name doesn’t matter)
- Tagging options is a cool feature that amazon gives you to track your billing easier if you are hosting multiple stores. These tags will show up in your billing console.
- Click create!
Congrats! You are now hosting a server in the cloud! This will take a moment to spin up, so we will move onto our next step while that loads.
Our next step is to buy a domain name for our website. This is the URL, like google.com. Again, much like server hosting options, there are dozens of different providers to get this domain. For the sake of keeping billing simple, we will be using route 53, but if you have a domain name on another system you can skip this step.
- Go back to your management console
- Click services and search for route 53 (or scroll to networking & content delivery)
- Under the Register domain section, type the domain name (like google) for your website. If you don’t have one in mind(or yours is taken) many sites can help you generate a name
- Click check, and hopefully, it will process. If it doesn’t try another name, or instead .com, maybe a .co
Awesome! Now you have a domain name and a server. Now you need to make them talk to each other, so let’s head back to the server. At this point, the server should be running and you are going to click it. You will be taken to this page:
Now, click on the networking tab. What we are going to do is change some rules so that our server will work as expected. Scroll down to firewall and click add another. Add rules so that it looks like this:
Now go back to the connect tab, and click connect using ssh. This is going to open a terminal, which looks scary, but I promise it’s not. If you get an error that says it can’t connect it might not be done setting up, so you may just need to wait a few more minutes.
So all that you need to do is follow the directions and type “sudo plesk login” and hit enter. You will be given a URL, which you will copy and paste into a browser. You might an error from your browser telling you that your connection is not private, but that is because you have not yet set up your certification.
You will be asked to make an admin account, this is very important. Once you log in there will be a button that says “add domain”.Follow the instructions being sure to hit the button that says “secure the domain with Let’s Encrypt” if it gives you errors, don’t worry about it and you can try again later.
At this point, if you go to your website, you will get an error. That is because you haven’t finished updating our relationship between the server and the domain name.
- Copy your IP address. This is the 4 numbers separated by periods like this 0.0.0.0
- Head back to route 53
- Click hosted zones
- Click your domain
- Click create a record set
- Create an “A” type record with a name of blank and value of your IP address.
- Click create
Awesome! Now if you go to your website you will get a page that says something like “this website isn’t set up yet!” This means your server and your domain are now linked to each other. We are going to stop at this point, and next time we will learn how to get Magento up and running!
It's social media for devs
Level up every day