- this gists is tested base nginx/1.10.1, rack 2.0.1
- rack just provider many handler, use fcgi u should install it's deps by self
- sudo apt-get install libfcgi-dev
- gem install fcgi # deps libfcgi
rackup config.ru
| require 'bundler' | |
| Bundler.require(:default, ENV.fetch("RACK_ENV")) | |
| SOCK_FILEPATH = "./rack.sock" | |
| Rack::Handler::FastCGI.run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["It Works"]] }, File: SOCK_FILEPATH |
| server { | |
| listen 8080; | |
| server_name localhost; | |
| access_log logs/host.access.log main; | |
| location / { | |
| fastcgi_pass unix:/${APP_SOCK_FILEPATH}.sock; # APP_SOCK_FILE_PATH is your rack app unix-domain-sock filepath | |
| } | |
| error_page 404 /404.html; | |
| redirect server error pages to the static page /50x.html | |
| # | |
| error_page 500 502 503 504 /50x.html; | |
| location = /50x.html { | |
| root html; | |
| } | |
| } |