Backstory
First, allow to me to say this: I love GoDaddy as a company. Their ads may be cheesy, but I don’t recall ever seeing too many of them to begin with. Their service is what I pay them for. I have had three hosting accounts with them, two Linux and one Windows (testing some ASP.Net stuff out). I cut it down to one hosting plan, per their suggestion. All it required was an update to a Deluxe hosting account.
GoDaddy’s hosting is, in my opinion, the right balance between powerful features (if you know what you’re doing) and ease of setup (if you don’t). I pay a year at a time.
So why am I changing, if I’m so happy with them?
Simple. I have the technical skills (or the interest in improving said skills) to replicate what they are doing for me, with a hosting company that will cost me about half what I’m paying GoDaddy.
I discovered Digital Ocean (Disclaimer: this is my Affiliate link) when I was looking at expanding my skill set from a LAMP stack to something more modern. While GoDaddy’s hosting is great, they are focused only on a LAMP stack (meaning Linux, Apache, MySQL, PHP). There are newer ways to write web apps using Ruby on Rail, Python/Django, and NodeJS with some sort of JavaScript framework. Digital Ocean simply rents you a Virtual Private Server (VPS) and you choose what you want to do with it. In most cases, they already have a Droplet (their name for a VPS) prebuilt for that purpose. They are not kidding about the 55 second install time, either.
If you are just going to do a LAMP stack and don’t want have the skills to pull this off, try GoDaddy. If you are trying to build up your Linux skills in being a webmaster, then Digital Ocean is perfect.
What I’ve learned thus far
It’s complicated. Your basic LAMP stack may be better, but I repurposed a general purpose Linux install, so I had to install each and every component to make a LAMP stack (other than Linux, which was 55 seconds).
Log into your VPS via “ssh USER@IPADDRESS” and provide your password. You will be the root user at this point.
Install Apache if necessary. Configuration will follow below…
Test your Apache installation by switching to your browser and entering your IP address of your VPS. It should display a general Page about Apache web server . If you can see that page, then it’s working. We’ll replace it later.
When you install MySQL (if necessary), you will want to run the Security feature of the install. After that, you WILL want to install PHPMyAdmin. This makes your MySQL administration SO much easier. I cannot stress this enough.
To test your version of PHP (or to test to see if PHP is even installed):
CD to your directory that you want the websites to be at (something like /website). If you use the default path, it will be in /var/www/html (for CentOS and for Ubuntu).
Type in “touch phpinfo.php”. This will create the file. Then edit via “nano phpinfo.php” (or if you’re really a glutten for punishment “vi phpinfo.php”.)
Create your start PHP tag, then enter phpinfo(); (semicolon is a part of that line), then your closing php tag. Save the file.
Switch to your browser and enter your IP address of your VPS, followed by /phpinfo.php
e.g. IPADDRESS/phpinfo.php
If PHP is installed, it will spit out a very detailed report about every facet of its configuration and modules. If you get nothing, then PHP is not installed.
Make sure that both Apache and MySQL will start up automatically. In your SSH session, type in “chkconfig httpd on” and “chkconfig mysqld on”. If you don’t, when you restart your machine, they won’t be running. If this has happened, you can start them with “service httpd start” or service mysqld start”.
Apache Configuration
Edit your Apache configuration file with nano or vi (found at /etc/httpd/conf/httpd.conf on CentOS- on Ubuntu, they have moved to multiple files- see https://help.ubuntu.com/lts/serverguide/httpd.html for more assistance).
# DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # #DocumentRoot "/var/www/html" DocumentRoot "/websites" … # This should be changed to whatever you set DocumentRoot to. # #<Directory "/var/www/html"> <Directory "/websites"> … # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # # The index.html.var file (a type-map) is used to deliver content- # negotiated documents. The MultiViews Option can be used for the # same purpose, but it is much slower. # # DirectoryIndex index.html index.html.var index.htm DirectoryIndex index.html index.html.var index.htm index.php
Three things to notice: DocumentRoot, Directory, and DirectoryIndex.
Best practice is to copy the line you want to modify, then paste it in underneath and modify the copy. A # comments out the default line.
If you want to change the default directory where your website files live (like /websites, for example), then you will need to make sure that the world can see the files. DO this by typing “chmod 755 -R /websites” (if /websites is your folder.)
If you want to host more than one domain on your single hosting instance, then you will need to edit one more section of the Apache config file, the VirtualHost section. Each section will start with <VirtualHost *:80> and end with </VirtualHost> . Rinse and repeat for each section. When you’re done editing this file, restart your Apache web service with “service httpd restart”.
ServerAdmin YOURNAME@DOMAIN1.com DocumentRoot /websites/DOMAIN1/ ServerName www.DOMAIN1.com ServerAlias DOMAIN1.com ErrorLog "logs/DOMAIN1.info-error_log" #CustomLog "logs/DOMAIN1.info-access_log" common ServerAdmin YOURNAME@DOMAIN2.com DocumentRoot /websites/DOMAIN2/ ServerName www.DOMAIN2.com ServerAlias DOMAIN2.com ErrorLog "logs/DOMAIN2-error_log" #CustomLog "logs/DOMAIN2-access_log" common
NOTE: If the ErrorLog and CustomLog log files don’t exist, then Apache WILL NOT START! (ask me how I know this…)
Getting to your website(s) from the world
You will need to update your DNS records at wherever you registered your domain at. For me, this was GoDaddy.
Sign into GoDaddy and go to the details of your domain. Click on DNS Zone File.
Write down the original IP address for the @ record. You will then edit that record (and ONLY that record) to reflect the IP address of your VPS at Digital Ocean.
Does this seem like a lot of work? Confused by all the techno babble? Then GoDaddy hosting may be a better choice for you…
Next up in pt 2 …Moving databases and blogs from GoDaddy to Digital Ocean