parm530
4/4/2018 - 3:33 PM

Website Server

Rails 4

Web Server

  • Apache
    • Ships with macOS
    • Lots of features, lots of configurations
  • Nginx
    • Doesn't ship with macOS
    • Newer than apache
  • LigHTTPd
  • Mongrel
  • WEBrick
    • Last 3 are lighter weight
    • Not much configurations, bare minimum to get the app deployed
    • MORE SPEED due to less features
    • WEBrick: simple web server, ships with Rails
    • Start Rails server: rails s or rails server
    • Site will be available on host: localhost and will be listening on port 3000 http://localhost:3000

Handling Errors in Production

  • In config/environments/production.rb, set config.consider_all_request_local = false
    • prevents the usual red screen with errors
    • Just show error pages: HTML error pages: public/
    • Contain no ruby code, no rails helper, no template layouts, just STATIC html code!
  • Exception Notification
    • Send email notification when errors occur
    • gem "exception_notification"
    • Send test email in console: ExceptionNotifier.notify_exception(StandardError.new("Test exception"))

Deploying

  • Find and ISP that offers Rails application hosting
    • Blue Box, Brightbox, Engine Yard, Heroku, Linode, Rackspace
  • Install all software on the remote server
  • Choose a web server
    • Apche, Nginx, Lighttp = FULL FEATURES
    • Passenger/mod_rails, Unicorn, Mongrel = LIGHT WEIGHT
  • Get deployment tools