I’m trying to deploy a rails app, but i can’t make it happen because nginx is not working properly.
Basically i follow that enter link description here to setup my digitalocean droplet, install ruby, postgre and finally capistrano. During that, when i install nginx, i access my machine ipv4 public ip and nginx was working well, the default page was there. So i keep the article, so when i get on the final step, when i use capistrano to deploy, my nginx stop serve, and i can’t find why.
I search a lot to know what is happen but i can’t find it, i will dispose some logs below but i think it’s everything looking ok
myapp from /etc/nginx/sites-available
server {
listen 80;
listen [::]:80;
server_name _;
root /home/deploy/botmae/current/public;
passenger_app_root /home/deploy/botmae/current;
passenger_enabled on;
passenger_app_env production;
passenger_preload_bundler on;
location /cable {
passenger_app_group_name botmae_websocket;
passenger_force_max_concurrent_requests_per_process 0;
}
# 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 2024-04-25 21:35:49.7339 59540/T1 age/Cor/CoreMain.cpp:1015 ]: Passenger core online, PID 59540
[ N 2024-04-25 21:35:52.4535 59540/Tb age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (ne>App 59624 output: 2024-04-25T21:37:22.390Z pid=59624 tid=19l8 DEBUG: Sidekiq client with redis options {:url=>"redis://>App 59624 output: [INFO : websocket @ 2024-04-25 21:37:22.705] Discord using gateway protocol version: 9, requested: 9
App 59624 output: /home/deploy/botmae/shared/bundle/ruby/3.1.0/gems/rack-3.0.10/lib/rack/file.rb:5: warning: Rack::File>2024/04/25 21:38:31 [info] 59782#59782: Using 131072KiB of shared memory for nchan in /etc/nginx/nginx.conf:61
[ N 2024-04-25 21:46:14.1779 59540/T5 age/Cor/CoreMain.cpp:670 ]: Signal received. Gracefully shutting down... (send si>[ N 2024-04-25 21:46:14.1779 59540/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting unt>[ N 2024-04-25 21:46:14.1780 59540/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connecti>[ N 2024-04-25 21:46:14.1782 59540/T8 Ser/Server.h:901 ]: [ApiServer] Freed 0 spare client objects
[ N 2024-04-25 21:46:14.1783 59540/T8 Ser/Server.h:558 ]: [ApiServer] Shutdown finished
[ N 2024-04-25 21:46:14.1783 59540/T5 Ser/Server.h:901 ]: [ServerThr.1] Freed 0 spare client objects
[ N 2024-04-25 21:46:14.1783 59540/T5 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
[ N 2024-04-25 21:46:14.1805 59540/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connecti>2024/04/25 21:46:14 [info] 60481#60481: Using 131072KiB of shared memory for nchan in /etc/nginx/nginx.conf:61
[ N 2024-04-25 21:46:14.2998 60483/T1 age/Wat/WatchdogMain.cpp:1377 ]: Starting Passenger watchdog...
[ N 2024-04-25 21:46:14.3274 60486/T1 age/Cor/CoreMain.cpp:1340 ]: Starting Passenger core...
[ N 2024-04-25 21:46:14.3276 60486/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2024-04-25 21:46:14.3336 60486/T1 age/Cor/CoreMain.cpp:1015 ]: Passenger core online, PID 60486
[ N 2024-04-25 21:46:17.0403 60486/Tb age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (ne>2024/04/25 21:47:53 [info] 60531#60531: Using 131072KiB of shared memory for nchan in /etc/nginx/nginx.conf:61
App 60600 output: 2024-04-25T21:54:01.481Z pid=60600 tid=18rg DEBUG: Sidekiq client with redis options {:url=>"redis://>App 60600 output: [INFO : websocket @ 2024-04-25 21:54:01.821] Discord using gateway protocol version: 9, requested: 9
App 60600 output: /home/deploy/botmae/shared/bundle/ruby/3.1.0/gems/rack-3.0.10/lib/rack/file.rb:5: warning: Rack::File>
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
netstat -tuln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:45155 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
tcp6 0 0 ::1:5432 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:6379 :::* LISTEN
udp 0 0 127.0.0.53:53 0.0.0.0:*
mod-http-passenger.conf
### Begin automatically installed Phusion Passenger config snippet ###
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;
so i restart nginx, try to find something in the logs but there is nothing wrong.
when i run capistrano, he finish deploys, and on his logs there one thing to notice, he tries to restar passenger and the passenger says he won’t recognize any apps running, above you can see
** Invoke passenger:restart (first_time)
** Execute passenger:restart
00:57 passenger:restart
01 passenger-config restart-app /home/deploy/botmae --ignore-app-not-running
01 There are no Phusion Passenger(R)-served applications running whose paths begin with '/home/deploy/botmae'.
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.0WGa4uX
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.0WGa4uX
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.4BZ9P6t
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.4BZ9P6t
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.6QQ2lO2
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.6QQ2lO2
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.8BFRi5b
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.8BFRi5b
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.A7tNZrS
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.A7tNZrS
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.GiLPUdD
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.GiLPUdD
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.P0RCLyO
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.P0RCLyO
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.YM2H8gk
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.YM2H8gk
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.YbWk4Vt
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.YbWk4Vt
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.fcYbhKo
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.fcYbhKo
01 *** Cleaning stale instance directory /var/run/passenger-instreg/passenger.g2bhMek
01 Warning: Permission denied @ dir_s_rmdir - /var/run/passenger-instreg/passenger.g2bhMek
✔ 01 deploy@ip 0.717s