Ask A Question

Notifications

You’re not receiving notifications from this thread.

Followed the deploy instructions; nginx throwing a 500 for rails app

Matt Bjornson asked in Servers

I'm not sure what happened, but I had a production environment/config working with nginx/passenger deployed on Digital Ocean. I am not seeing errors in log files, but nginx is throwing a 500 when I try to access the rails app.

sudo passenger-status

Version : 6.0.4
Date    : 2020-02-15 04:02:15 +0000
Instance: xfvpDfe9 (nginx/1.14.0 Phusion_Passenger/6.0.4)

----------- General information -----------
Max pool size : 6
App groups    : 1
Processes     : 2
Requests in top-level queue : 0

----------- Application groups -----------
/home/deploy/crispy-sniffle/current (production):
  App root: /home/deploy/crispy-sniffle/current
  Requests in queue: 0
  * PID: 5005    Sessions: 0       Processed: 2       Uptime: 16s
    CPU: 2%      Memory  : 61M     Last used: 4s ago
  * PID: 5028    Sessions: 0       Processed: 1       Uptime: 15s
    CPU: 2%      Memory  : 46M     Last used: 15s ago
        ```

        /etc/nginx/sites-enabled/crispy-sniffle
        ```
        server {
        listen 80;
        listen [::]:80;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        passenger_enabled on;
        #passenger_ruby /home/deploy/.rbenv/versions/2.7.0/bin/ruby;
        passenger_app_env production;
        root /home/deploy/crispy-sniffle/current/public;


        location /cable {
            passenger_app_group_name myapp_websocket;
            passenger_force_max_concurrent_requests_per_process 0;
        }
        # Add index.php to the list if you are using PHP
        #index index.html;

        server_name shapeandship.com www.shapeandship.com;
        # Allow uploads up to 100MB in size
        client_max_body_size 100m;

        location ~ ^/(assets|packs) {
            expires max;
            gzip_static on;
        }
                }
                ```
                /var/log/nginx/error.log
                ```
                [ N 2020-02-15 04:01:31.6096 4918/T1 age/Wat/WatchdogMain.cpp:1373 ]: Starting Passenger watchdog...
[ N 2020-02-15 04:01:31.6503 4930/T1 age/Cor/CoreMain.cpp:1340 ]: Starting Passenger core...
[ N 2020-02-15 04:01:31.6505 4930/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2020-02-15 04:01:31.6589 4930/T1 age/Cor/CoreMain.cpp:1015 ]: Passenger core online, PID 4930
[ N 2020-02-15 04:01:34.0365 4930/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)

I can see my browser hitting nginx in /var/log/nginx/access.log

196.52.2.101 - - [15/Feb/2020:03:45:46 +0000] "GET / HTTP/1.1" 500 2363 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13$
196.52.2.101 - - [15/Feb/2020:03:51:15 +0000] "GET / HTTP/1.1" 500 2363 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13$
196.52.2.101 - - [15/Feb/2020:03:53:23 +0000] "GET / HTTP/1.1" 500 2363 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13$
196.52.2.101 - - [15/Feb/2020:04:01:59 +0000] "GET / HTTP/1.1" 499 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.$
196.52.2.101 - - [15/Feb/2020:04:02:00 +0000] "GET / HTTP/1.1" 500 2363 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13$
196.52.2.101 - - [15/Feb/2020:04:02:12 +0000] "GET / HTTP/1.1" 500 2363 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13$

lastly /etc/nginx/conf.d/mod-http-passenger.conf

passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
#passenger_root /home/deploy/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/passenger-6.0.4;
passenger_ruby /home/deploy/.rbenv/versions/2.7.0/bin/ruby;

What am I doing wrong? Any help would greatly be appreciated.

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 74,071+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.