How to develop Sinatra project
如何Sinatra部署项目
Add the application entry
Sinatra is a rack-based application like Rails. Before deployment, add a config.ru file to the root of the Sinatra project with the following content:
require "myapp" # Main file of your project
run Sinatra::Application # If it is a defined subclass, use the name of the class you defined directly
After that, the process is basically the same as deploying rails, using Nginx + Passenger as an example.
Install Nginx and Passenger
gem install passenger
sudo passenger-install-nginx-module
Adding Nginx to services and self-start
wget https://raw.github.com/gist/1548664/53f6d7ccb9dfc82a50c95e9f6e2e60dc59e4c2fb/nginx
sudo cp nginx /etc/init.d/
sudo chmod +x /etc/init.d/nginx
sudo update-rc.d nginx defaults
Config Nginx(/opt/nginx/conf/nginx.conf)
server {
listen 3000;
server_name localhost;
location / {
root /srv/my_app/public;
passenger_enabled on;
}