Web server( A computer that hosts a website on the internet ) is a computer which is host one or more website. Web Server words means have two things one is Hardware and second is Software. Hardware means a computer whose store inside software and website file (HTML, CSS, JS). Second One is software whose have http server. it's give access to the user of hosted website and what process is follow to accessing the website and here comes the role of http server.
How does works Web Server ?
In web server have hosted website file and http server(software),software is a http server whose get browser request via http request and then http server fetch the file inside the web server. Http server understand URL and HTTP(the protocol how to access the website inside the web server) and http server get access the file via domain name of the websites it stores, and it deliver the content of these hosted websites to the end's user device. The clint get some information to use browser and the browser make http request to the web server where the web server have http server, http server to check the file in hosted website and if got those file which is clints wats, the http server gave file to http response and browser get the file. If http server not get the file they show error 404 to responding the browser.
Server types
For publishing website we need to Server Where we hosted the website. Web server are two types Static web server and Dynamic web server.
Static Web Server
A static web server is a computer with a http server whose serve the website as it is, No any dynamically changes because in static website have no any database.
Dynamic Web Server
Dynamic web server also have a static web server and software, most commonly an application server and a database, the application server is dynamically change via http server the user provide some information before sending content to the browser via http server.
Hosting File
First, a web server host the website's file all HTML, CSS and JS file. We can store the file on our locally computer but more convenient to store on web server because
- A dedicated web server typically more available for up and running.
- A dedicated web server dose not change the IP address, those IP address are fixed(but our local server IP address always change).
- A dedicated web server is always connected to the internet.
- A dedicated web server have maintain by third party.
How communicate browser through HTTP ?
A web server provide support for HTTP(Hypertext Transfer Protocol ). A http specifies how to transfer hypertext between two computer. A protocol is a set of rules for communication between two computer. HTTP is a textual and stateless protocol.- Textual means all command are in text format which is human readable.
- Stateless means neither the computer and nor the user remember previous communication. Ex:- A server never remember the your password and your failed transaction. For these type get result you need the application server.
What is Apache ?
Apache is a web server whose host the web content and delivered the internet. Apache is just one component that is needed in a web application stack to deliver web content. One of the most common web application stacks involves LAMP, or Linux, Apache, MySQL, and PHP.
What is Live Server ?
This is a little development server with live reload capability. Use it for hacking your HTML/JavaScript/CSS files, but not for deploying the final site.
There are two reasons for using this:
- AJAX requests don’t work with the
file://
protocol due to security restrictions, i.e. you need a server if your site fetches content through JavaScript. - Having the page reload automatically after changes to files can accelerate development.