Search code examples
ruby-on-railsamazon-ec2production-environmentthinamazon-ami

Production environment THIN is not loading data


When I'm trying to serve a ruby project (I'm migrating this project from another server where is working perfectly) with thin in production, I can't access to the site, however its working perfectly in development

$ thin start -e production
Using rack adapter
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop

In another terminal:

$ curl http://localhost:3000
[deploy@host dir]$

But if I try with development environment, curl is showing me the content correctly.

The log/production.log doesnt show anything at all.

My versions:

ruby -v ruby 2.0.0p647 (2015-08-18) [x86_64-linux]

rails -v Rails 4.2.1

thin -v thin 1.6.3 codename Protein Powder

But if I create a new ruby project, thin is serving it with no issues:

curl http://localhost:3000
<!DOCTYPE html>
<html>
<head>
  <title>The page you were looking for doesn't exist (404)</title>
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <style>
  body {

Any ideas about what configuration I'm missing? I precompiled all my assets (just in case). The project is working with Passenger in the previous server

Thanks

/Cris


Solution

  • So the problem was the config.force_ssl parameter in config/environments/production.rb, it was in "true", but in the new server I didnt have the SSL configuration ready yet, so I changed it to false and it worked!

      # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
      config.force_ssl = false
    

    I hope it helps!

    Cheers