You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rails+Passenger+Nginx部署第二个应用时出现404 Not Found问题求助

Troubleshooting 404 Error for Second Rails App on Passenger/Nginx

Hey there, let's work through your 404 issue with the second Rails app deployed on DigitalOcean using Passenger and Nginx. I noticed a few key details that are likely causing the problem—let's break them down:

1. Critical Typo in Nginx Root Configuration

This is the most obvious fix first: look at the discrepancy between your Nginx config and the error log.

  • In your second app's Nginx config (philosophische_insel.conf), the root path is set to:
    root /var/www/philosopische_insel/public;
    
  • But your error log shows Nginx is trying to access:
    "/var/www/philosophische_insel/public/index.html" is not found
    

You're missing an 'h' in the directory name in your Nginx config! The correct path should match the log's target directory: philosophische_insel. Fix this typo, save the config file, and restart Nginx with:

sudo systemctl restart nginx

This is why Passenger isn't picking up your second app—Nginx is looking in the wrong directory, so it never triggers Passenger to spawn the Rails application process (hence it doesn't show up in passenger-status).

2. Verify Ruby Wrapper Path Validity

Your two apps use different Ruby versions, which is totally fine, but let's confirm the passenger_ruby path for the second app is correct:

  • Run this command to check if the wrapper points to the right Ruby version:
    /home/sandro/.rvm/gems/ruby-3.0.0/wrappers/ruby -v
    

It should output ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]. If not, re-create the RVM wrapper for Ruby 3.0.0 with:

rvm use 3.0.0
rvm wrapper ruby-3.0.0 --no-prefix ruby

3. Confirm App Directory Permissions

Make sure the Nginx/Passenger process user (typically www-data) has read access to your second app's directory:

sudo chown -R sandro:www-data /var/www/philosophische_insel
sudo chmod -R 755 /var/www/philosophische_insel

This ensures Passenger can access your Rails app's files to spawn the application process.

4. Validate Passenger Multi-App Operation

After fixing the typo and permissions, run passenger-status again. You should now see your second app listed under "Application groups". If not, check the Nginx error log again for new issues, and ensure you've restarted Nginx (not just reloaded—sometimes reload doesn't pick up path changes for new apps).


内容的提问来源于stack exchange,提问作者Metaphysiker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 03:42:40