The command "rails s" that I used casually. With this command, I realized again what was working and how, so I will write it down.
** Supplement ** rails s is a command to start a local server.
In order to distribute the processing load (high-speed processing), the servers are divided by function.
** Web server ** Receive all requests from the client side. If the content of the request is static (HTML or CSS), the web server returns a response to the browser (client). If the content of the request is dynamic (searching for information from the database, etc.), pass the request to the application server.
** Application server ** Receives the request passed from the web server and performs the corresponding controller action. After that, the processing result is returned to the Web server.
Type rails s in the terminal to launch the server. At that time, puma is displayed on the terminal. This is an application server for Rails and is not separated from the web server.
=> Booting Puma => Rails 22.214.171.124 application starting in development => Run `rails server --help` for more startup options Puma starting in single mode... * Version 3.12.6 (ruby 2.6.5-p114), codename: Llamas in Pajamas * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://localhost:3000 Use Ctrl-C to stop
In the production environment, the web server and application server are separated. As mentioned above, the reason is to take measures against server load such as concentrated access. Build a production environment by combining Nginx (Web server) and Unicorn (application server).