Score:-4

Does every application needs web server?

bj flag

Server is just a machine with web server software(like nginx, apache etc). When we host a website in hosting services like GoDaddy or cloud services, does they provide web server software for every application which is deployed or there will be only one web server software for a machine(server) and every application uses it or we(client) needs to set up web server software?

Does a server can have `n' number of web server software?

In the DNS record, does each application domain's record point to server's IP address or web-server's IP address?

If all the application domains in one server point to same IP address, then how the requests are routed to specific application?

If there is anything wrong in the question, please point out as I am new to these topics.

djdomi avatar
za flag
Requests for product, service, or learning material recommendations are off-topic because they attract low quality, opinionated and spam answers, and the answers become obsolete quickly. Instead, describe the business problem you are working on, the research you have done, and the steps taken so far to solve it.
Score:3
my flag

Server is just a machine with web server software(like nginx, apache etc).

Not necessarily. A server is a computer system that is used to serve other systems (clients) with content, data which it processes (or simply get from other sources) and returns to the clients.

It may be a Web server, if it serves content via the HTTP protocol, or a database server, if it stores data and allows data manipulation in a relational (SQL) or non-relational way, or a DNS server, if it serves information about hostnames and IP addresses through the DNS protocol, and so on.

When we host a website in hosting services like GoDaddy or cloud services, does they provide web server software for every application which is deployed or there will be only one web server software for a machine(server) and every application uses it or we(client) needs to set up web server software?

It depends. Some provide virtual machines (or similar) with pre-installed Web servers like Apache, and you "only" have to configure them properly for your application. Others (AWS EC2) simply provide plain virtual machines and you have to install and configure any service or package (including a Web server) you may need.

Does a server can have `n' number of web server software?

Yes. The same server can host different Web server tools (for example, Apache and Nginx, for different applications), or even different instances of the same Web server technology (for example, through containers), or a single Web server tool which handles multiple applications (possibly using virtual hosts).

In the DNS record, does each application domain's record point to server's IP address or web-server's IP address?

It should point to whatever IP address is routable and reachable from the outside and is somehow "tied" to the Web server. A simple setup may be a virtual machine with a single IP address and the web server listening on that IP address. But the web server may also internally listen on another address, such as 127.0.0.1, and use some technique (like NAT) to receive HTTP requests with the VM IP address as destination address. And so on.

If all the application domains in one server point to same IP address, then how the requests are routed to specific application?

This can be done in a number of way. First, you can have different processes listening on the same IP address but on different ports. As long as the port is different, there is no conflict - http://www.example.com:80 will reach a different web server (or web server instance) than http://www.example.com:8080. By using different ports and tying each port to a process or process "instance" (e.g. virtual host), each request is forwarded to the right application.

EDIT

Trying to answer the additional questions in the comments.

what if multiple applications are deployed on shared server instead of VM's? As everyone wants port as 443(default one) if the application uses HTTPS, how the requests get routed? and what would be the Ip address of DNS record of domain will point to?

If multiple applications listen on the same port and same IP, other kinds of traffic manipulation can be performed. For example, let's assume the same IP is tied to three applications:

app1.example.com - port 443

app2.example.com - port 443

app3.example.com - port 443

How is an HTTP request to the same IP address and port redirected to the right application? One way is to use the Host header. If a browser wants to contact app1.example.com, it will send an HTTP request to that same IP and port with a Host header set to "app1.example.com". A reverse proxy will take that request, read the value of the Host header, and redirect that request to the process associated to "app1.example.com", even if that process listens on the same IP and port as the other web servers.

Another different approach relies on using a machine (VM, baremetal - doesn't matter) with multiple IP addresses. If the same machine has multiple IP addresses, it can hosts different applications on the same port but different addresses, without using any HTTP header trick.

bj flag
Hey @A. Darwin, what if multiple applications are deployed on shared server instead of VM's? As everyone wants port as 443(default one) if the application uses HTTPS, how the requests get routed? and what would be the Ip address of DNS record of domain will point to?
bj flag
Also how does the web-server will be associated to each application in this case?
bj flag
It will be really helpful if you provide the answer for shared servers(like many applications deployed in one server instead of VM's) as well
jm flag
@vinter While a given server can have multiple web services running (apache, nginx, etc) running at the same time, only one particular instance can be listening on port 443. Multiple applications will require either listening on different ports, have different hostnames/CNAMES defined (apache vhosts for instance), or be natted in the case of VMs or containers.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.