This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.
Please make sure that your Gemfile in your rails application includes unicorn.
require 'date' | |
require 'active_support/core_ext/object/to_query' | |
require "active_support/core_ext/numeric/time" | |
require 'launchy' | |
flights = [ | |
{from: 'SYD', to: 'LAX', date: Date.new(2022,12,9), delta: (0..2)}, | |
{from: 'LAX', to: 'NAN', date: Date.new(2023,02,2), delta: (0..2)}, | |
{from: 'NAN', to: 'SYD', date: Date.new(2023,02,7), delta: (0..2)} | |
] |
school,sex,age,address,famsize,Pstatus,Medu,Fedu,Mjob,Fjob,reason,guardian,traveltime,studytime,failures,schoolsup,famsup,paid,activities,nursery,higher,internet,romantic,famrel,freetime,goout,Dalc,Walc,health,absences,G1,G2,G3 | |
GP,F,18,U,GT3,A,4,4,at_home,teacher,course,mother,2,2,0,yes,no,no,no,yes,yes,no,no,4,3,4,1,1,3,6,5,6,6 | |
GP,F,17,U,GT3,T,1,1,at_home,other,course,father,1,2,0,no,yes,no,no,no,yes,yes,no,5,3,3,1,1,3,4,5,5,6 | |
GP,F,15,U,LE3,T,1,1,at_home,other,other,mother,1,2,3,yes,no,yes,no,yes,yes,yes,no,4,3,2,2,3,3,10,7,8,10 | |
GP,F,15,U,GT3,T,4,2,health,services,home,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,yes,3,2,2,1,1,5,2,15,14,15 | |
GP,F,16,U,GT3,T,3,3,other,other,home,father,1,2,0,no,yes,yes,no,yes,yes,no,no,4,3,2,1,2,5,4,6,10,10 | |
GP,M,16,U,LE3,T,4,3,services,other,reputation,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,5,4,2,1,2,5,10,15,15,15 | |
GP,M,16,U,LE3,T,2,2,other,other,home,mother,1,2,0,no,no,no,no,yes,yes,yes,no,4,4,4,1,1,3,0,12,12,11 | |
GP,F,17,U,GT3,A,4,4,other,teacher,home,mother,2,2,0,yes,yes,no,no,y |
### Keybase proof | |
I hereby claim: | |
* I am vhsalazar on github. | |
* I am vhsalazar (https://keybase.io/vhsalazar) on keybase. | |
* I have a public key ASAjCDnM2xie4DT3bxKFu3xiFG4KYJviSF9JVO-NrsLQHAo | |
To claim this, I am signing this object: |
upstream backend { | |
server 127.0.0.1:9000; | |
} | |
log_format default_log '$host $remote_addr [$time_local] "$request" $status $request_length "$http_referer" "$http_user_agent" $request_time'; | |
server { | |
listen 80; | |
server_name _; # all accept | |
access_log /var/log/nginx/access.log default_log; |
require 'webrick' | |
class NonCachingFileHandler < WEBrick::HTTPServlet::FileHandler | |
def prevent_caching(res) | |
res['ETag'] = nil | |
res['Last-Modified'] = Time.now + 100**4 | |
res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0' | |
res['Pragma'] = 'no-cache' | |
res['Expires'] = Time.now - 100**4 | |
end | |