How a web hosting server works
It’s worth knowing exactly what’s going on with your website’s hosting server. Web hosting companies do a good job of marketing their features and benefits, but they usually don’t explain the basics.
What will you learn in this chapter?
What is an operating system, web server, database, and application language?
Which option for each of these is most popular in the web hosting environment.
The difference between a server and a web server.
What is the LAMP stack?
A hosting server is just a computer.
When it comes down to it, we’re talking about something no different than your personal desktop or laptop computer. Servers are a little bigger, a lot more powerful, and usually don’t have their own monitors and keyboards, but at heart they’re just like the computers you use every day.
Besides being much more powerful, the computers used to run websites have very fast internet connections, so many visitors can access the server at the same time.
Server operating systems
The operating system is the primary interface between applications, users, and the physical computer. You use an operating system every day, even if you never think about it.
If you have a PC, your operating system is Windows. If you use a Mac, you have OSX. Your phone probably runs Android or iOS.
Just like your home or office computer, servers need an operating system. The most common operating system for servers is Linux.
If you’re new to Linux or have heard of its difficulties with personal computing, don’t worry. While very few people use Linux for desktop computers at home or in the office, Linux is the absolute standard for servers.
It’s easy to use, too. Web hosting companies provide control panels, management tools, and installation tools, so you don’t need to know (or worry about) Linux at all to have a successful web hosting experience.
Some hosting plans provide servers running the Windows Server operating system. Don’t get confused here.
Even if you run Windows on your computer, there’s no reason to use Windows on a server as well. There’s no real benefit to adapting these operating systems.
The only reason to use Windows for your server is if you need it to run proprietary software that simply won’t run on Linux, like .NET, ASP, or Microsoft Silverlight.
For everything else – WordPress, Drupal, Joomla, any application written in PHP, anything built with Ruby or Python – Linux is the operating system of choice.
Virtual Private Server (VPS)
“Server” refers to the physical or virtual machine, the computer that holds your website’s files and database. Here you can see VPS server hosting packages
Unfortunately, there can be some confusion of terms because there is also a piece of software called a “web server.” The web server is the software responsible for handling requests from the internet.
When you type a URL into your browser’s address bar, it translates into a request that is routed to the computer that hosts the website you are looking for.
The web server—that is, the software called the web server—handles the request. It reads the request, finds out what other applications need to run or access the files, and then, once it’s complete, sends a response back to the browser.
The response it sends back is (usually) the page of the website you are trying to view. The web server software acts as an intermediary between the internet and the files on the server.
The basic process of how a website works.
The most common web server is an open source program called Apache. You can find it in most web hosting plans. There are several alternatives, the most common of which is probably nginx. If you happen to be running a Windows server, you may be running IIS.
Unless you have some incredibly specific needs, Apache is just fine. For the most part, you’ll never notice your web server or care about it.
Database management system
Most (not all, but most) websites require a database management system to store content and other information. This could be blog posts, pages, product information, customer data, or any other type of content, depending on the type of website you run.
The most common database management system is MySQL. It is a very powerful open source software tool for running complex databases. It is free to use, and is already available with many web hosting plans.
MySQL is the database of choice for the most popular content management systems, such as WordPress, Drupal, and Joomla. It also powers a number of e-commerce platforms, website builders, bulletin board systems, and social networking applications.
There are several other database systems used by certain applications, and you may encounter them if you are doing something unique.
For example, PostgreSQL is an open source RDBMS that is functionally very similar to MySQL, and is the default database for Ruby on Rails.
So if you use this framework, you should make sure you find a hosting company that supports it.
Application Layer – Scripting Languages
Most websites (not all, but most) today are dynamic in some way.
When you think about the database and web server in the last two sections, it’s clear that there needs to be some kind of software that fetches content from the database and sends it to the web server. This is what all applications like Content Management Systems (CMS) are about.
Whether it’s a simple blogging engine, a complex CMS, an e-commerce site, or a project management system (or anything else), websites with interactive features and dynamic content are computer software, and must be written in a programming language.
You don’t need to know the language to use the program, but your web hosting server does. The most popular language for dynamic web applications is PHP, and you’ll find that the vast majority of web hosts support this language.
If you need to use an application (or develop an application) in another language (Ruby and Python are popular) make sure you find a web hosting company that supports the language you need.
Lamp cartridge
LAMP cartridge
In each section above, I identified the most common option in each category: Linux for the operating system, Apache for the web server, MySQL for the database, and PHP for the application.
These four technologies are sometimes referred to as the “LAMP stack,” where LAMP is an acronym (Linux, Apache, MySQL, PHP). If you see web hosting sites or application requirements mentioning the LAMP stack, that’s what it means.
Modules
Some applications require modules or plugins specific to one or more of these technologies. The two most common places that require additional modules are the web server (Apache) and the application language (PHP).
For example, if your application will have pretty URLs (clean URLs with human-readable names instead of computer-generated codes), your application may require the Apache mod_rewrite module.
If your application does a lot of server-side work with images, you may need the GD graphics library for PHP.
It’s a good idea to check the specific requirements of your intended application, then compare different web hosting companies to see if they have the features you need.
A note about versions
All of these tools have different versions released, for example PHP 5 and PHP 7. Most web hosting companies use the latest stable release for each technology, but policies vary.
You usually don’t need to worry about things like modules and version numbers if you use a one-click installer tool like Softaculous, Fantastico, or simple scripts.
However, if you are installing something manually, it is a good idea to double-check these kinds of things.
Summary
A server is a computer (physical or virtual) that runs a website. This computer houses a package of interconnected software that runs your website.
The following two are absolutely required:
operating system
Web server
If you are doing anything other than serving static files, you should also:
Database
Programming language
Software that runs a website.
The most common choices in these four items are the LAMP stack: Linux (operating system), Apache (web server), MySQL (database), PHP (programming language).
Make sure the web hosting provider you choose supports the technologies required for the applications you plan to use.
The article was translated from English to Hebrew.
Written by Adam Michael Wood



