1

I was just thinking if an app like rails or laravel can receive the request from different server applications like apache or nginx, there must be some sort or request format the servers follow to serve the request to the apps?

What format is this?

Or am I conceptualizing this wrong?

3
  • 1
    You mean a format like HTTP? Sep 7, 2018 at 21:08
  • I guess I'm confused at what happens between the server and the application. The server recieves an http request format...looks up the virtual host file matching that route...then opens that virtual host file and directly passes the http request to that file? Or does the server make any changes to the http request? Sep 7, 2018 at 21:12
  • It's not clear what you are asking. You should state an example to make it simple to understand. Rails and Laravel are frameworks, they don't process or serve content. Neither do Apache or Nginx by themselves when using those technologies, they use modules or interpreters (mod_php, passenger, etc.) Sep 8, 2018 at 6:20

2 Answers 2

3

You're not conceptualizing this wrong, you've got the right idea!

There are several ways of doing this:

  • CGI scripts: the webserver sets variables, executes an application for each request, passes the request body on stdin and expects an http response on stdout
  • Proxying: the application is its own webserver and nginx/apache simly proxy to it
  • uwsgi/fastcgi: the application and apache communicate over a socket, using a special protocol to transfer request/response information
  • built-in modules (e.g. mod_php in apache): the webserver embeds an interpreter for the language of your script.
2
1

The term you are looking for I think is SAPI - Server Application Interface generically, ISAPI (IIS) and NSAPI (Netscape, if they are still around?) more specifically.

Check out this answer to a language-specific (PHP) question regarding how all of that works - https://stackoverflow.com/a/38669983/6867430

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .