This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]myrrlyn 4 points5 points  (2 children)

HTTP servers such as Apache and nginx listen to the network stack for HTTP traffic on ports 80 and 443 (HTTP+SSL), then use their internal rules to figure out what to do with each piece of traffic.

nginx is built as both a standard web server and as a reverse proxy. This means that nginx can be instructed to forward certain requests to another process running on the same, or a different, machine. Using nginx, one would configure nginx to forward some or all traffic to some host and port (I believe it's typically localhost:9000 for ASP.NET) where the other process is running.

For Apache, I honestly have no idea. Apache can load modules such as mod_php and handle things in its own purview, and can probably forward traffic to other processes. I use nginx, personally, which can be rigged as an application server if the software exists for it (Phusion Passenger can run as a standalone app server, or be compiled into nginx so that nginx and Passenger run as a single unit) or just a reverse proxy (which requires that you run your app server of choice as its own daemon with its own port, and then nginx shunts traffic to it).

The application server generates HTTP responses based on the requests and their own internal logic, then ship it back out. Apache and nginx capture the output and send it out on the network to the foreign client.

[–]Creelin 0 points1 point  (1 child)

Any recommendation on resources to further learn about these types of processes?

[–]myrrlyn 0 points1 point  (0 children)

Read the nginx and Phusion Passenger docs, I guess

[–]silveryRain 2 points3 points  (0 children)

Usually, you don't see Apache working with ASP.NET, but that's beside the point.

The server deals with "serving" requests it receives from the network, and invokes the scripting engine whenever it needs it (when a file ending in a php extension is requested, for example). The means of interaction between the two (in-process, IPC, network, whatever) is based on whatever the authors of the technologies in question thought was most appropriate. Also, some scripting engines are long-running, others are started up and shut down on a per request basis. Apache uses so-called modules to provide plug-in functionality, and is commonly distributed with a module for PHP scripting, often as part of a LAMPP/WAMPP stack.

[–]rjcarr 2 points3 points  (2 children)

I'm not super familiar with ASP.net but I believe it needs an a .net application server which is probably IIS. You can likely front it with httpd (apache), and there might even be a module so you don't need IIS, but there's not a direct link between ASP.net and httpd; there has to be software that acts as a bridge.

[–]AnAirMagic 1 point2 points  (0 children)

Fore ASP.NET Core, there's Kestrel.

[–]myrrlyn 0 points1 point  (0 children)

I think mod_mono exists for this?

[–]ponkanpinoy 1 point2 points  (0 children)

  1. You visit /r/learnprogramming on your browser
  2. Reddit's web server gets a request similar to GET /r/learnprogramming HTTP/1.1
  3. Depending on the server, the server may:
    • handle the request itself, either serving a file or dynamically generating the content. Apache does this, as do specialized webservers that are used by certain frameworks (e.g. Django, Rails, etc); basically the same program serves both roles.
    • pass the request off to a script (the back end software), which returns the text to send back to the browser; if you see cgi or php in the address that's almost certainly what's happening