Ruby Application Server Configuration
The platform offers Ruby application servers based on two software stacks:
- Apache Ruby
- NGINX Ruby
Both are initially configured to utilize the Passenger application server by default, integrated via the appropriate custom module. Additionally, the NGINX Ruby stack can be easily reconfigured to work with different built-in servers:
- Passenger: One of the most feature-rich application servers for Ruby, invaluable for modern web apps and microservice APIs.
- Puma: A Ruby web server focused on speed and parallelism, thanks to fast and accurate HTTP 1.1 protocol parsing.
- Unicorn: An HTTP server leveraging Unix/Unix-like kernel features for serving fast clients on low-latency, high-bandwidth connections.
Let’s explore how you can switch between these servers on the NGINX Ruby server.
NGINX Application Server Modules
The Passenger module is utilized for all newly created Ruby environments by default. Follow these steps to switch to a different module:
Step 1. Click the Config button next to your NGINX Ruby application server.
Step 2. In the opened configuration file manager panel, navigate to the /etc/nginx/nginx.conf file. Look for the following lines:
include app_servers/nginx-unicorn.conf
include app_servers/nginx-puma.conf
include app_servers/nginx-passenger.conf
These lines specify the inclusion of configuration files for different NGINX application server modules.
Step 3. Uncomment the line corresponding to the desired module and comment out the previously active one.
For instance, if switching to Puma, uncomment the line associated with Puma and comment out the line of the previously active module.
Step 4. Save the modifications and Restart the nodes of the NGINX application server to implement the changes.
Step 5. Access your node via SSH (e.g., using Web SSH) and execute the chosen module with the appropriate command from the project directory.
cd /var/www/webroot/ROOT/
pumactl -F config/puma.rb --pidfile puma.pid -S puma.state start &
Note: If you wish to switch to a different module, follow the same procedure, but ensure to stop the currently running application srver:
- For Puma: Execute pumactl -F config/puma.rb –pidfile puma.pid -S puma.state stop
- For Unicorn: Use ps aux | grep ‘unicorn’ | awk ‘{print $2}’ | xargs kill -QUIT