Web hosting can get expensive really quick, so in this post I want to talk about VPS’s and give you a nice spoonfed tutorial on how to set them up. We are going to be setting up a cheapo $5/month server running Nginx on Ubuntu. I learned all this stuff real inefficiently (took me far too long) so I wanted to write a very in-depth guide on VPS’s for all you affiliates and SEO’s out there who are looking to get cheap hosting.
First things first, what is a VPS and why would you want one? VPS stands for Virtual Private Server. It’s your own little computer (usually Linux) on the internet that will eventually (by the end of this tutorial) become your web server which you will use to host your websites.
What’s cool is that VPS’s are not just limited to being web servers. For instance, you could install VPN software on it which effectively cloaks your real IP address and makes browsing the internet far more secure from hackers. Instead of paying $5 or $10/month for a VPN service which you share with tons of other people, you can install VPN software (its free and called OpenVPN) on your own VPS so you have your own truly private VPN. There are also many SEO tools that can be run on VPS’s.
Maybe you are building a PBN and want to host each PBN domain on its own server (separate IP’s and all that) for as cheap as possible. Maybe you want to setup a Prosper202 tracking domain that can handle a decent amount of traffic for a new campaign of yours. I have a 1GB Prosper202 server that never crashed after doing some decently high volume Facebook campaigns (10 clicks/second at peak times). The only con is that you have to set them up and manage them yourself. But then again, that’s why I put together this post! To prepare you and give you all the information and resources you would need. For those who aren’t technical, you’ll be excited to know that we will be using a script called TuxLite that automates the entire server setup process. It’s very easy, all you need to be able to do is follow directions, copy/paste, and watch some Youtube videos which teach the basics on the Linux command line.
Ready? Let’s get started.
VPS Basics: Pricing, Where to Buy, How Much RAM Should They Have
There are TONS of companies that offer VPS’s. I’d guess in the tens of thousands. You don’t want to get a VPS from just anywhere, ESPECIALLY when you’re a beginner. Many providers go out of business or are run by people just trying to make money. Just stick with the big ones until you know what you’re doing. For this tutorial, we are going to be using DigitalOcean because they’ve been great to me for years now and on my Tier 1 list of good VPS Providers.
I’d suggest that you only deal with the VPS providers on this list for now:
- DigitalOcean ($5/month for 512MB RAM)
- Linode ($10/month for 1GB RAM)
- Ramnode ($15/year for 128MB, $32/year for 256MB. TrafficplusConversion.com is on Ramnode!)
- Amazon AWS (one of the best but I wouldn’t say it’s newbie friendly)
A good place to go for other, lesser-known providers is LowEndBox. Pay attention to their top providers poll. Keep in mind, I wouldn’t setup a VPS from just any company on there though (many could be out of business in a year and it would suck to have to move your websites somewhere else). LowendBox also runs a forum called LowEndTalk which I’ve found to be helpful when researching providers.
Quick Note on VPS Pricing
The more RAM, the more expensive the VPS is. Ultra-small VPS’s, like one’s with 128MB of RAM, only cost $1 or $2 per month. VPS’s with 4GB of RAM are like $40/month. If you’re building a PBN and need lots of cheap hosting accounts for relatively low traffic sites, it makes sense to buy a bunch of 128MB or 256MB ones. If you want to setup a Prosper202 server, a good one to choose would be the 1GB plan from DigitalOcean for $10/month. 1GB is plenty powerful enough if you’re running like 10,000 clicks per day. Heck, I’d bet 512MB is enough if you’re running 10,000 clicks per day.
Unmanaged vs Managed
The reason you will see such a huge range of prices for VPS’s is because the more expensive ones are “managed”. “Managed” means that the company sets up the server for you and you can call them up and tell them to install stuff for you. I’m convinced that all they do is run an “update” command for you every month or so. That’s what you’re paying for basically.
For comparison, a HostGator “semi-managed” VPS with 1GB of RAM costs like $35/month while the unmanaged VPS’s we are interested in cost about $10/month for the same thing. A very well known VPS provider many affiliates use is LiquidWeb. Their 1GB Storm VPS runs $50/month. You are paying for the support and customer service with VPS plans like that, which is totally worth it for sites that make a lot of money. Your PBN or Prosper202 domain does not have that level of importance, which is why we want the cheap “unmanaged” VPS plans.
How much RAM do you need? How Many Sites Can You Host?
When in doubt, choose 512MB. They are very cheap (~$5/month) and plenty powerful enough to run a couple WordPress sites, a personal VPN for yourself, and hundreds of plain HTML/CSS sites. A VPS is not limited by the number of sites you can host, it’s only limited by how much power (RAM) and CPU it has.
For WordPress Sites
On a small VPS with say, 256MB of Ram, you could definitely host quite a few WordPress installs. I did a load test with Blitz.io on a 512MB of mine, without WP Super Cache, and got the following results:
Analysis: This rush generated 2,720 successful hits in 60 seconds and we transferred 31.46 MB of data in and out of your app. The average hit rate of 45.33/second translates to about 3,916,800 hits/day. The average response time was 79 ms.
As you can see, that’s a lot of traffic. That WordPress install didn’t even have WP Super Cache enabled. While that test was with a 512MB server, a 256MB would still be able to handle a lot of traffic. Some of the reasons why this server can handle so much traffic is because I am using Nginx, and have disabled something in my MYSQL configuration called
innodb which is better but also requires more power. I am also using
memcache and a PHP cache, which definitely help out big time. If this WordPress reached into a read the database on every page load (that’s an expensive operation, computationally speaking) it wouldn’t be able to handle near this amount of traffic.
For Plain HTML Sites
A 256 RAM server could run thousands of plain HTML/CSS websites that each get thousands of visitors per day. Why? Because the server doesn’t need very much RAM at all to serve plain HTML. HTML/CSS is very “light”, while anything to do with MySQL is “heavier”. I did a load test on a 128MB server of mine with just a thick content page in HTML/CSS, no PHP going on whatsoever. Here are the results of that test:
Analysis: This rush generated 7,189 successful hits in 60 seconds and we transferred 90.01 MB of data in and out of your app. The average hit rate of 119.82/second translates to about 10,352,160 hits/day. The average response time was 27 ms.
As you can see, you don’t need high power VPS’s to run websites.
Let’s Get Started: Setting up a 512MB VPS on DigitalOcean
Now that we’ve got the intro out of the way, let’s get started. We are going to be setting up a VPS from DigitalOcean with 512MB of RAM which costs $5/month. The whole purpose of this article is to show you how easy it is to setup servers. The whole process takes about 20-30 minutes, although it will take you a lot longer the first time. We are going to go step-by-step and I’m gonna include lots of screenshots for you. I’ll embed Youtube videos that further explain and demonstrate things when they are necessary.
What We Are Installing
Ubuntu 14.04LTS – this is our Server OS. We are using it because it’s basically the most popular one out there. There’s a ton of information out there on various blogs if things stop working and you need help. We don’t want to be using some obscure operating system that we can’t find much information or support for. Ubuntu 14.04 is one of the most popular OS’s in the world for setting up servers, if not the most popular one. Ubuntu 12.04 is a good choice too, but we will be using 14.04.
LEMP Stack – A LEMP stack is Linux Engine-X Mysql PHP. This is in contrast to the extremely popular LAMP stack, where A stands for Apache. These are all the things we need to run a website. Linux OS as our main system, Nginx as our web server, MySQL for anything that requires databases (like WordPress) and PHP. If you’re wondering, Ubuntu is just a “flavor” of Linux. It’s supposed to be most beginner friendly which is why it’s so popular.
Nginx – we are going to be setting up Nginx as our HTTP server. We are NOT using Apache even though Apache has historically been the most popular HTTP server in the world. Nginx just works better. It’s faster and uses less RAM . We are setting up VPS’s that have low RAM already so Nginx is the best choice. Apache has the reputation of hogging RAM, while Nginx has the reputation for being wicked fast with low memory usage. I feel like my websites load instantly without hesitation on Nginx, so it’s all I use these days. This website is on a Nginx server, click around, do the pages load almost instantly for you? When this site was on an Apache server (years ago) I felt like there was a delay/hesitation whenever I clicked any links. I hate websites that take more than 1 second to load. Apache is good too, but I think only if you are good at tuning it.
Other software to install – remember, we are not limited to installing just a web server. We can turn our VPS into a HTTP proxy by installing a package called Squid. We can take it a step further and install a full on VPN with a software package called OpenVPN. I like installing Squid and/or OpenVPN on all my VPS’s because it allows me to mask my true IP address when I visit websites. And since I have like 10 VPS’s, I can choose between 10 IP’s at any given time. If you’ve ever been banned by Google Adwords or Facebook Ads before, you’ll know that you can’t just re-open an account very easily (they have you tracked, IP address being one method they use). Getting a new account from Google/Facebook after being banned is a little bit more involved than just setting up a VPN on your own server to hide your true identity, but I think it gets the point across. Proxies/VPN’s are useful in many situations.
Finally, the Section Where We Go Step-By-Step with Pictures
I go to DigitalOcean and create an account from the homepage. I then confirm my email. After confirming my email and logging into DigitalOcean for the first time, I need to add a credit card to activate the account. Once I add my credit card, I am ready to Create a Droplet [see pic]. Droplet is just what they call a individual VPS.
The next page asks me to fill out a bunch of basic information. I will use a hostname of srvr1, choose the $5/month plan, select New York as the datacenter where my VPS will reside, and leave all other settings unchecked.
Under Select Image, I will choose Ubuntu 14.04 x32. The x32 means 32-bit, as opposed to 64 bit. I wouldn’t choose 64-bit unless the server had at least 2GB of RAM. I remember reading that 32-bit is way better for low RAM systems.
I will leave everything else blank and click “Create Droplet”. Takes about 60 seconds to do it’s thing and then brings me to an overview of my new Droplet.
All setup! Now we need to check our email and get the username/password to the server!
Connecting To Our New VPS in Terminal
OK guys, this is where things are going to start getting a little intense. In order to manage our new server, we have to do it on the command line. I actually quite like working on the command line, but I was very intimidated by it in the beginning. I’m gonna embed a couple Youtube videos so you can visually watch and hear someone explain things, and I’ll also do my best to write clearly and point out the things that confused me when I first started.
On Mac OSX, you need to open Terminal, which is located at
Applications/Utilities/Terminal. When you first open Terminal, it will look something like this:
I’m not going to include any screenshots for Windows users, because that would just take me too long. Since Windows doesn’t have a program like Terminal, you need to go and install PuTTY. All the commands are going to be the same, the Windows Terminal is just a separate program called PuTTY.
Logging Into Our VPS for the First Time
The way you connect to a VPS (with Terminal or PuTTY) is by using a command called
ssh. The full command looks like this:
ssh username@IP. In our case, we are logging in as the root user to our Droplet which has an IP of 22.214.171.124. So we type in
ssh firstname.lastname@example.org and press Enter. Immediately after pressing Enter, I see this “Authenticity of Host” message.
That message always pops up the first time you login, because it doesn’t recognize your computer. Things are fine, type out yes and press enter. Immediately after typing yes it closed the connection for some reason. Probably because I took so long writing this paragraph out (I’m doing this live as I write this post). I just re-entered
ssh email@example.com and pressed enter. You’ll see in the picture below that it now asks me for my password (instead of that Authenticity of Host message).
When you type in your password, it will appear as if nothing is happening. I was SO CONFUSED by this when I first was learning. I was expecting to see **** or something as I typed out my password, like you see when you fill out a password form online. Fact is, it’s SUPPOSED to not show anything when you are typing passwords, it’s a security feature. I still remember how absolutely defeated I felt when the very first thing I tried to do didn’t work as I expected it to. I hope this small alert saves you from feeling that same embarrassment, haha.
Now is a good time to stop for a moment and explain a few things. The command-line is NOT point and click. On our computers, we are accustomed to double-clicking on folders and seeing them open up. Our computers have a Graphical User Interface (GUI), the command-line is the exact opposite of a GUI (there is none!). We are used to pointing our cursor somewhere on the screen, clicking once to drop it there, and we start doing our thing. You can’t do that on the command-line. Everything is done with the keyboard. When you wanna move the cursor, you use the arrow buttons on the keyboard, not your mouse.
Learn Basic Linux Commands
Here’s a very good Youtube video series (40 mins, 5 parts) that explains a lot of the basic commands we will be using. I strongly suggest you watch it before moving on with the tutorial, unless you already know this stuff.
Did you watch all 5-parts to the video? Good. If not, it’s only 40 minutes!
Ok, so here are the main commands that I know by heart.
cd – change directory.
pwd – print working directory
ls – list items in folder. I use this command more than any other by far. I cd into a new folder and immediately
ls to see what’s inside
nano – nano is the command-line version of Notepad. To edit a file, I
cd my way into a folder that contains the file I want to edit, and then I type in
aptitude update; aptitude safe-upgrade; – upgrades all the software on your VPS to the newest version. Including it here because it’s one of the few I know by heart.
apt-get install packagename – this is how we install new software
aptitude install packagename – aptitude is supposed to be a better version of apt-get. Including it here because you will see it later on.
Just knowing how to login with
cd around the filesystem and
ls folders is about the minimum you need to know.
The first time you login to Ubuntu, it will force you to reset the root password to something of your choosing. It will make you type in the current password again and then your new password twice. Here’s a screenshot of that [pic].
We’re in! I logged in with the root user and typed
pwd to show me which directory we are in.
As you can see in the pic above, the root folder is located at
/root. You probably won’t ever go into this folder ever again. When it comes to managing servers, there are only a few folders you will ever go into. Before I explain what those are, let me go to the root directory and
ls it so you can see what we’re working with.
I will highlight in green the only folders I have ever gone into. They are
/var. I have no idea what all the other folders do so don’t let them overwhelm you.
/etc – holds configuration files for the things we install, like Nginx, PHP, etc…
/home – any users we create get a folder in here, which is where our website will go
/var – this folder holds logs for certain things in
I don’t want you to feel overwhelmed if you’re new to this (I sure was!). There may be a lot of files and folders, but we aren’t concerned with most of them. Most of the work we do will be in either the
/home/username folder or the
Where Will the Website Eventually Go?
The files for the website will eventually go into
/home/username/domains/website1.com/public_html/ and when you login with
ssh you’ll automatically be dropped in the
/home/username folder. We haven’t gotten to that yet – I’m just trying to help you get oriented in the filesystem and where things will eventually go. Just remember that the
/home/username directory is where all the action will be later on. If your name is bob the folder will be
/home/bob. Right now we are logged in as the root user, and when we login as root we get automatically dropped in the
/root folder. Things will keep clearing up as we keep going.
Installing The Webserver. Making Progress!
Our next step after logging in successfully for the first time and getting acquainted with the filesystem is to download a script called TuxLite which will automate the entire installation of our server! We are complete monkeys using basic commands like
ls, we couldn’t possibly setup a whole server ourselves. Thankfully Tuxlite will do all that for us. See, you don’t have to be an expert to do this. The TuxLite links take you to the installation page but I will repeat them here and explain as we go.
First thing to do is
cd ourselves into the /home directory. The command for that is
Next, we will make a folder (
mkdir) called tuxlite and
cd into it. Look at my screenshots and follow along.
Now we run 2 commands,
wget http://tuxlite.com/scripts/tuxlite.tar.gz (downloads the script) and
tar xzf tuxlite.tar.gz (extracts it). Look at my screenshots and read the commands.
The files we extracted from Tuxlite with the
tar command can be seen in the last lines of the screenshot above, where I did an
ls so you can see what it did. You can see there’s a few files there. Not only will this script automate the setup of our server, there’s a few other goodies in there, like automatically installing WordPress and a utility that automates backups. Following with the instructions on the Tuxlite installation page, the next command to run is
nano options.conf which brings up this page:
nano command is how you edit text files in Linux. I really don’t feel like trying to explain it so I’ll just embed this video which does it better than I can anyways.
options.conf file is where we customize our install. You can choose Nginx or Apache. Mariadb or Mysql. Use the arrows on your keyboard to place the cursor where you need it to be (can’t use the mouse, remember). I am going to change
srvr1 because I named my Droplet srvr1 in the very beginning. I messed that up. I’ll just make them match now so I don’t have to edit it later. You can leave
HOSTNAME_FQDN=srvr1.yourdomain.com alone, it’s only important if you want to send email from your VPS. Just replace yourdomain.com with ANY domain you own. We want to edit the server IP line. The last line we want to edit is
MYSQL_ROOT_PASSWORD. Here’s a screenshot of mine all filled out.
To actually save a file that you edited in Nano, you want to Exit. It will sense that the file has been edited and ask you if you want to save it. Look at the bottom of the screenshot above where it says ^X. On my computer, that is control-x. Not sure on Windows. Remember, on the command-line everything is done with the keyboard. When I press control-x it shows this:
You just press y and press enter to save it.
Again, following the instructions on the Tuxlite installation page we do the following commands:
chmod 700 *.sh
chmod 700 options.conf
apt-get update && apt-get -y install aptitude
and then we check out the script functionality with the next 2 commands
Here’s a screenshot with what we see:
Now we are finally ready to ditch this root account we’ve been using all along and setup our own user account. We run the
adduser john command and it asks me for a password, to retype it for confirmation, and a bunch of extra information that you don’t need to fill out.
Last but not least, we run the final
./install.sh command which will install our server with the settings we used in the
options.conf file that we edited. This will take a little while to complete (10-15 minutes or so), but when it’s finished our server is totally setup! Wasn’t that hard, right? The Tuxlite script really automates everything. We just have to know the bare bones basics, which you can learn from the videos I embedded. While the install script is running, it would be a good time to keep track of all the usernames and passwords we used. Make a .txt file on your desktop called srvr1.txt or something like that and paste everything in there.
Here is what you’ll see when the script is done running:
You’ll notice it says root login disabled near the bottom. Since the root user has the power to do everything (even destroy the VPS), it’s common to disable the root user and only use your user account to log back in. Just to show you what happens, I am going to type
exit to close the connection and try to
ssh firstname.lastname@example.org back in with the root user.
exit is how you logout.
On the screenshot above, see where I typed
exit and the next line I typed
ssh email@example.com to log back in? It asked me for my password but says ‘permission denied’ because the root login has been disabled. Instead we will login with that new user account we made. Remember, the
ssh pattern is
ssh username@IP so I type in
Look at the commands I typed in the screenshot and notice how I logged back in, this time as the user john.
All Setup, Time To Start Adding Domains
We need to navigate back to the tuxlite folder with
cd /home/tuxlite. We then issue the command
./domain.sh add john myshinynewdomain.com
What the hell? Why isn’t that working? It’s because we are logged in as
root. john doesn’t have the authority to add a domain. What we have to do is first elevate ourself to superuser by typing in
su and then typing in our root password. We can’t login as root anymore, but we can become root once we are logged in by typing
su. Here’s a screenshot of me doing that.
Now we can re-try adding our domain with
./domain.sh add john myshinynewdomain.com
Now let’s navigate to our john folder and run a
We now have a domain folder. I will
cd into that and
We’ve now got our domain in there! I don’t actually have a domain called myshinynewdomain.com but if you did all you would have to do is add an ‘A’ record with the IP address to this Droplet in your registrar. You can then use john and the IP address to login via SFTP with whatever client you use for that.
Holy cow, this post is at 4,000+ words already. I know I should add more but I will stop here for now. If you are interested in me going into a bit more detail, please leave a comment. If you get stuck and need some help, hit me up at trafficplusconversion [at] gmail and I’ll help you get this figured out.
P.S. Check out my recommended tool:
Easiest A/B Testing & Funnel Tracking Software
Run Unlimited A/B Split Tests On Unlimited Domains, Easily Track Conversions Across Your ENTIRE Sales Funnel, Track How Well Each Of Your Traffic Source Converts On Your Funnel...
...and get it all done in 3 minutes FLAT!