Score:0

Passenger not running (Ruby on Rails + Nginx)

ru flag

My AWS instance was working fine with my app. But, today, the server was down without memory ram. Then I run:

sync; echo 1 > /proc/sys/vm/drop_caches
sudo service nginx start

After that, ram memory consumption is ok, but the app not. I'm running a Rails 4.2.1 website with Ruby 2.2.2 and nginx/1.8.0 in a Ubuntu 14 AWS instance.

When I access the site, I have the error:

502 Bad Gateway
nginx/1.8.0

When I run passenger-config restart-app I have:

*** ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it
is running, then the causes of this problem could be one of:

 1. You customized the instance registry directory using Apache's
    PassengerInstanceRegistryDir option, Nginx's
    passenger_instance_registry_dir option, or Phusion Passenger Standalone's
    --instance-registry-dir command line argument. If so, please set the
    environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory
    and run this command again.
 2. The instance directory has been removed by an operating system background
    service. Please set a different instance registry directory using Apache's
    PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir
    option, or Phusion Passenger Standalone's --instance-registry-dir command
    line argument.

In the file /var/log/nginx/error.log I have:

2021/06/19 13:21:12 [crit] 26618#0: *48688773 connect() to unix:/tmp/passenger.26EHXct/agents.s/server failed (2: No such file or directory) while connecting to upstream, client: XXX.XXX.34.163, server: www.XXX.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.26EHXct/agents.s/server:", host: "XXX.com"

I already tried this solution and not working.

When I run: passenger-config validate-install I have:

Use <space> to select.
If the menu doesn't display correctly, press '!'

 ‣ ⬢  Passenger itself
   ⬡  Apache

---------------------------------------------

 * Checking whether this Passenger install is in PATH... ✓
 * Checking whether there are no other Passenger installations... ✓

Everything looks good. :-)

When I run: sudo passenger-memory-stats I have:

Version: 5.0.10
Date   : 2021-06-19 13:31:40 -0300
------------- Apache processes -------------
*** WARNING: The Apache executable cannot be found.
Please set the APXS2 environment variable to your 'apxs2' executable's filename, or set the HTTPD environment variable to your 'httpd' or 'apache2' executable's filename.


---------- Nginx processes ----------
PID    PPID  VMSize    Private  Name
-------------------------------------
26615  1     230.7 MB  26.3 MB  nginx: worker process
26616  1     230.4 MB  27.4 MB  nginx: worker process
26617  1     229.7 MB  25.8 MB  nginx: worker process
26618  1     233.3 MB  27.4 MB  nginx: worker process
### Processes: 4
### Total private dirty RSS: 106.78 MB


--- Passenger processes ---

### Processes: 0
### Total private dirty RSS: 0.00 MB

Anyone knows how can I solve this?

Score:0
ru flag

When I ran sudo service nginx restart, I didn't notice the flag [fail] on the right of the terminal.

Then, I ran sudo service nginx status I got the message nginx is not running.

After ran sudo nginx -t I got the message

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

But I saw several nginx processes, then, I killed all nginx process with sudo kill $(ps aux | grep '[n]ginx' | awk '{print $2}') and then, sudo service nginx start.

Everything works fine again.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.