You have built your website on your local computer and now need to host it on an internet server. How do you go about doing it?
As a first step you need to buy a domain name and a hosting plan from a web services provider. After you have purchased a Web Hosting package for your domain name, your hosting provider will send you a welcome email containing basic details of how to access your hosting account control panel. Typically, if you purchase a windows hosting plan, you would be provided with a Plesk control panel, and if you purchase a linux hosting plan, you would be provided with a cPanel. Additionally, your hosting provider would also provide you with ftp login details. You will need to upload your website files, setup databases, if any, and create email accounts.
A lot of help is available from within your cPanel/Plesk control panel on how you can setup databases and email accounts.
In this article and a series of subsequent articles, I will only cover where and how you can conveniently upload your website files using a standard ftp client.
You can configure and use any FTP client to upload content to your website hosting server. In subsequent articles I will deal with this in more detail to explain how to upload your website files using various ftp clients. You can use any one of the various ftp clients available. Most of the ftp client software are available free on the internet and you can download any one and install it on your computer.
A website that you host on an internet server would have a well-defined directory structure. Given below is the directory structure for Plesk and cPanel managed hosting accounts, to help you understand the significance of each directory for your website.
From amongst the several directories found within your Plesk Windows Hosting package, the following are relevant and important:
|\httpdocs||This is your website's home directory. It should contain all files that are part of the website. Any file and folder inside this directory is visible over the Internet unless you password protect it.|
|\error_docs||When visitors come to your site and request pages that the web server cannot find, the web server generates and displays a standard HTML page with an error message. The standard error messages may inform of problems but they do not usually say how to resolve them. You can create your own error pages and upload them in this directory.|
For Plesk Windows Hosting package, upload your website content to the httpdocs folder.
A typical Plesk setup will check for the existence of one of the below files and based on the order specified below, will display its content as the home page, when anyone tries to access your website with the url www.yoursite.com. Also, if anyone tries to access any sub-folder under httpdocs with the url www.yoursite.com/sub-folder-name, the web server will try to locate a file with one of the below listed names, in order, and send it across to the requesting web browser.
Note that the PLESK control panel allows you to modify the above list, i.e. you can:
The web server will essentially look for existence of the above listed file names in order from top to bottom, and the first file that it finds, it will proces it and return the results to the requesting website visitor's web browser.
If you were to upload a file index.html within the httpdocs folder of your website www.yoursite.com, then when a website visitor tries to reach either yoursite.com or www.yoursite.com, then he/she would be automatically displayed the contents of the index.html file. This happens since the web server treats the index.html file as the home page or default page for the domain.
Similarly, if you were to upload an index.html file within the /httpdocs/plants folder (as example), then when a website visitor types yoursite.com/plants or www.yoursite.com/plants, then he/she would be automatically displayed the contents of the index.html file within the plants sub-folder.
Now, if you were to upload two or more files from amongst the list given above, then the one mentioned higher in the order will be considered as the home page. So in the event that there exists an index.php and default.htm file within the same folder, then the index.php file will get considered as the home page.
From amongst the several directories found within your cPanel Linux Hosting package, only the following are important:
|/public_html||This is the home directory of your website and it contains all files that are part of the website. Any file and folder inside this directory is visible over the Internet unless you password protect it.|
|/www||This is simply a link/alias to the public_html directory.|
On a cPanel Linux Hosting server, upload your website content to the public_html folder. Do not upload under www folder. The folder www is simply a link/alias to the public_html folder.
A cPanel Linux Hosting server will check for the existence of one of the below files and based on the order specified below, will display its content as the Home Page, when anyone tries to list the content of any folder/directory:
If you were to upload a file index.html within the public_html folder of your website yoursite.com, then when a website visitor tries to reach either yoursite.com or www.yoursite.com, he/she will be automatically displayed the content of the index.html file. This happens since the server treats the index.html as the home page or default page for this directory.
Similarly, if you were to upload an index.html file within the /public_html/plants folder, then when a website visitor types yoursite.com/plants or www.yoursite.com/plants, he/she will be automatically displayed the content of the index.html file within the plants sub-folder.
Now, if you were to upload two or more files from amongst the list given above, then the one mentioned higher in the order would be considered as the home page. So in the event that there exists an index.php and default.html file within the same folder, then the index.php file will get considered as the home page.
Make sure that the computer that you use to access your hosting account either via cPanel/Plesk control panel or via ftp, is absolutely free of any viruses or spywares. Also, make sure that your website files themselves are free of viruses or malware. It is very important to have a genuine licensed version of a good anti-virus software installed in your local computer, which is periodically updated with latest virus and malware signatures.
After you have uploaded your website files on our hosting server, you may preview your website by visiting the website as you would visit any other website. Make sure that your name servers have propagated before you visit your website so that your domain is pointing to your hosting server. It normally takes 24-48 hours for name server propagation.
Rajeev Kumar is the primary author of How2Lab. He is a B.Tech. from IIT Kanpur with several years of experience in IT education and Software development. He has taught a wide spectrum of people including fresh young talents, students of premier engineering colleges & management institutes, and IT professionals.
Rajeev has founded Computer Solutions & Web Services Worldwide. He has hands-on experience of building variety of websites and business applications, that include - SaaS based erp & e-commerce systems, and cloud deployed operations management software for health-care, manufacturing and other industries.