0
My question is about web servers and libraries focused on protocol HTTP.
In PHP you can use "apache" as a web server, but in other languages the same stack is used? This doubt came to me when researching languages like: Go, Crystal, Hack, Ruby and Python.
I saw that in them libraries are focused on the protocol HTTP, on them you create your own web server, serving yourself or is an add-on to apache (for example)?
It would be like you create your own "requisitions" structure, shaping as your need?
I always kept this doubt, I know you will always need a web server, but I do not know if it will always be fit apache or Nginx (the ones I know).
Example:
Código tirado do site: cystal-lang.org
require "http/server"
server = HTTP::Server.new(8080) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello world, got #{context.request.path}!"
end
puts "Listening on http://0.0.0.0:8080"
server.listen
Grateful
Apache is one of the options. You could use PHP in Nginx, Lighthttpd and a multitude of other servers (and for testing, even PHP alone). It works even in IIS, although it is not a combination of the best. As for creating a structure of its own, it only depends on the purpose. I have things running in PHP, but for some things more punctual, I made a server of my own, for higher performance. It is a unique executable, which makes all the HTTP part, and the working logic. Same thing for Websockets. I chose one of my own to facilitate integration with other things of mine.
– Bacco
Detail: nothing would prevent me from making requests to PHP on my own server via CGI or something like that. HTTP is an extremely simple protocol. Care is in the details, and it’s hard to take care of file caching and modification, but no big secrets. HTTPS is more boring, but it has libraries open to it
– Bacco
I understood, php was an example, because I saw nothing related to creating your own server on it, always apache or others. In the case of other languages, is this assumed? Or I have to create my own server, ex in ruby or go, since they have HTTP libraries and most examples are, "look how simple it is to create an http server".
– G. M4rc14L
This varies widely.
– Bacco