Chapter 3
IN THIS CHAPTER
Understanding web hosting providers
Examining the various choices for hosting your site
Choosing the host that’s right for you
Looking around your new web home
Getting your site files to your web host
You will end up with better software by releasing as early as practically possible, and then spending the rest of your time iterating rapidly based on real-world feedback. So trust me on this one: Even if version 1 sucks, ship it anyway.
— JEFF ATTWOOD
You build your web pages from the comfort of your Mac or PC, and if you’ve chosen your text editor well (as I describe in Book 1, Chapter 2), then you can even use your computer to preview how your web pages will look in a browser.
That’s fine and dandy, but I think you’ll agree that the whole point of building a web page is to, you know, put it on the web! First, you need to subject your code to the wilds of the wider web to make sure it works out there. Even if it seems to be running like a champ on your local server, you can’t give it the seal of approval until you’ve proven that it runs champlike on a remote server. Second, once your code is ready, then the only way the public can appreciate your handiwork is to get it out where they can see it.
Whether you’re testing or shipping your code, you need somewhere to put it, and that’s what this chapter is about. Here you explore the wide and sometimes wacky world of web hosts. You delve into what they offer, investigate ways to choose a good one, and then take a tour of your web home away from home.
A common question posed by web development newcomers is “Where the heck do I put my web page when it’s done?” If you’ve asked that question, you’re doing okay because it means you’re clued in to something crucial: Just because you’ve created a web page and you have an Internet connection doesn’t mean your site is automatically a part of the web.
After all, people on the web have no way of getting to your computer. Even if you’re working with a local web development environment (which I discuss in Book 1, Chapter 2), you’re working in splendid isolation because no one either on your network or on the Internet can access that environment.
In other words, your computer isn’t set up to hand out documents (such as web pages) to remote visitors who ask for them. Computers that can do this are called servers (because they “serve” stuff out to the web), and computers that specialize in distributing web pages are called web servers. So your web page isn’t on the web until you store it on a remote web server. Because this computer is, in effect, playing “host” to your pages, such machines are also called web hosts. Companies that run these web hosts are called web hosting providers.
Now, just how do you go about finding a web host? Well, the answer to that depends on a bunch of factors, including the type of site you have, how you get connected to the Internet in the first place, and how much money (if any) you’re willing to fork out for the privilege. In the end, you have three choices:
If you access the Internet via a corporate or educational network, your institution might have its own web server you can use. If you get online via an Internet service provider (ISP), phone or email its customer service department to ask whether the company has a web server available. Almost all ISPs provide space so their customers can put up personal pages free of charge.
If cash is in short supply, a few hosting providers will bring your website in from the cold out of the goodness of their hearts. In some cases, these services are open only to specific groups such as students, artists, nonprofit organizations, and so on. However, plenty of providers put up personal sites free of charge.
What’s the catch? Well, there are almost always restrictions both on how much data you can store and on the type of data you can store (no ads, no dirty pictures, and so on). You might also be required to display some kind of “banner” advertisement for the hosting provider on your pages.
For personal and business-related websites, many web artisans end up renting a chunk of a web server from a commercial hosting provider. You normally hand over a setup fee to get your account going and then you’re looking at a monthly fee.
Why shell out all that dough when there are so many free sites lying around? Because, as with most things in life, you get what you pay for. By paying for your host, you generally get more features, better service, and fewer annoyances (such as the ads that some free sites have to display).
Unfortunately, choosing a web host isn’t as straightforward as you might like it to be. For one thing, hundreds of hosts are out there clamoring for your business; for another, the pitches and come-ons your average web host employs are strewn with jargon and technical terms. I can’t help reduce the number of web hosts, but I can help you understand what those hosts are yammering on about. Here’s a list of the terms you’re most likely to come across when researching web hosts:
Bandwidth: A measure of how much of your data the server serves. For example, suppose the HTML file for your page is 1KB (1 kilobyte) and the graphics associated with the page consume 9KB. If someone accesses your page, the server ships out a total of 10KB; if ten people access the page (either at the same time or over a period of time), the total bandwidth is 100KB. Most hosts give you a bandwidth limit (or “cap”), which is most often a certain number of megabytes or gigabytes per month. (A gigabyte is equal to about 1,000 megabytes.) Again, the more you pay, the greater the bandwidth you get.
If you exceed your bandwidth limit, users will usually still be able to get to your pages (although some hosts shut down access to an offending site). However, almost all web hosts charge you an extra fee for exceeding your bandwidth, so check this out before signing up. The usual penalty is a set fee per every megabyte or gigabyte over your cap.
Domain name: A general Internet address, such as wiley.com or whitehouse.gov. They tend to be easier to remember than the long-winded addresses most web hosts supply you by default, so they’re a popular feature. Two types of domain names are available:
To get a regular domain, you either need to use one of the many domain registration services such as GoDaddy
or Register.com
. A more convenient route is to choose a web hosting provider that will do this for you. Either way, it will usually cost you $35 per year (although some hosts offer cheap domains as a “loss leader” and recoup their costs with hosting fees; also, discount domain registrars such as GoDaddy offer domains for as little as $9.99 per year). If you go the direct route, almost all web hosts will host your domain, which means that people who use your domain name will get directed to your website on the host’s web server. For this to work, you must tweak the domain settings on the registrar. This usually involves changing the DNS servers associated with the domain so that they point at the web host’s domain name servers. Your web host will give you instructions on how to do this.
With a subdomain name, “webhostdomain.com” is the domain name of the web hosting company, and it simply tacks on whatever name you want to the beginning. Many web hosts will provide you with this type of domain, often for free.
Okay, you’re ready to start researching the hosts to find one that suits your web style. As I mention earlier, there are hundreds, perhaps even thousands, of hosts, so how is a body supposed to whittle them down to some kind of short list? Here are some ideas:
www.webhostingtalk.com
), a collection of forums related to web hosting.www.cnet.com/web-hosting
www.pcmag.com/reviews/web-hosting-services
www.reviewhell.com
http://reviewsignal.com/webhosting
After you sign up with a web hosting provider and your account is established, the web administrator creates two things for you: a directory on the server you can use to store your website files, and your very own web address. (This is also true if you’re using a web server associated with your corporate or school network.) The directory — which is known in the biz as your root directory — usually takes one of the following forms:
/yourname/
/home/yourname/
/yourname/public_html/
In each case, yourname
is the login name (or username) the provider assigns to you, or it may be your domain name (with or without the .com part). Remember, your root directory is a slice of the host's web server, and this slice is yours to monkey around with as you see fit. This usually means you can do all or most of the following to the root:
Your web address normally takes one of the following shapes:
http://provider/yourname/
http://yourname.provider/
http://www.yourname.com/
Here, provider
is the host name of your provider (for example, www.hostcompany.com or just hostcompany.com), and yourname
is your login name or domain name. Here are some examples:
http://www.hostcompany.com/mywebsite/
http://mywebsite.hostcompany.com/
http://www.mywebsite.com/
There's a direct and important relationship between your server directory and your address. That is, your address actually “points to” your directory and enables other people to view the files you store in that directory. For example, suppose I decide to store a file named thingamajig.html
in my directory and my main address is http://mywebsite.hostcompany.com/
. This means someone else can view that page by typing the following URL into a web browser:
http://mywebsite.hostcompany.com/thingamajig.html
Similarly, suppose I create a subdirectory named stuff
and use it to store a file named index.html
. A surfer can view that file by convincing a web browser to head for the following URL:
http://mywebsite.hostcompany.com/stuff/index.html
In other words, folks can surf to your files and directories by strategically tacking on the appropriate filenames and directory names after your main web address.
As a web developer, one of the key ways to keep your projects organized is to set up your directories on your computer, and then mirror those directories on your web host. Believe me, this will make your uploading duties immeasurably easier.
This process begins at the root. On the web host, you already have a root directory assigned to you by the hosting provider, so now you need to designate a folder on your computer to be the root mirror. If you’re using the XAMPP web development environment (see Book 1, Chapter 2), then the XAMPP installation’s htdocs
subfolder is perfect as your local root. Otherwise, choose or create a folder on your computer to use as the local root.
What you do from here depends on the number of web development projects you’re going to build, and the number of files in each project:
css
subfolder for CSS files, a js
subfolder for JavaScript files, and so on.To help you see why mirroring your local and remote directory structures is so useful, suppose you set up a subfolder on your computer named graphics
that you use to store your image files. To insert into your page a file named mydog.jpg
from that folder, you'd use the following reference:
graphics/mydog.jpg
When you send your HTML file to the server and you then display the file in a browser, it looks for mydog.jpg
in the graphics
subdirectory. If you don't have such a subdirectory — either you didn’t create it or you used a different name, such as images
— the browser won’t find mydog.jpg
and your image won't show. In other words, if you match the subdirectories on your web server with the subfolders on your computer, your page will work properly without modifications both at home and on the web.
C:xampphtdocsgraphicsmydog.jpg
This image will show up just fine when it’s viewed from your computer, but it will fail miserably when you upload it to the server and view it on the web. That’s because the C:xampphtdocs
part exists only on your computer.
Once your web page or site is ready for its debut, it’s time to get your files to your host’s web server. If the server is on your company or school network, you send the files over the network to the directory set up by your system administrator. Otherwise, you upload the files to the root directory created for you on the hosting provider’s web server.
How you go about uploading your site files depends on the web host, but here are the four most common scenarios:
www.globalscape.com/cuteftp
) and Cyberduck (https://cyberduck.io
). For the Mac, try Transmit (https://panic.com/transmit
) or FileZilla (https://filezilla-project.org
).https://panic.com/coda
) supports this too-handy-for-words feature.What happens if you send a web development file to your web host and then realize you’ve made a typing gaffe or you spy a coding mistake? Or what if you have more information to add to one of your web pages? How do you make changes to the files you’ve already sent?
Well, here’s the short answer: You don’t. That’s right, after you’ve sent your files, you never have to bother with them again. That doesn’t mean you can never update your site, however. Instead, you make your changes to the files that reside on your computer and then send these revised files to your web host. These files replace the old files, and your site is updated just like that.
18.191.174.168