There are a lot of moving parts here that I have varying levels of familiarity with, so I'm hoping another set of eyes will help me discover why I'm getting a 404 after deploying my Rails app on Nginx running Phusion Passenger.

My app's /public directory currently resides at:

>> /root/public_html/photobook/public

My server settings in nginx.conf:

server {
  listen 80;
  server_name pb.mysite.com;
  root /root/public_html/photobook/public;   # <--- be sure to point to 'public'!
  passenger_enabled on;

But after restarting nginx:

sudo /opt/nginx/sbin/nginx

Going to my browser displays a 404 page served up by Nginx.

Are there rules for handling subdomains differently than I'm not aware of? Or is this something else entirely?

Also, since I'm new to Passenger on Nginx, is there a log file I should find that might give me more helpful feedback on the 404, like what page it's looking up?



First, thanks for the advice on /var/log.

I didn't know about it; this will be a great help in the future.

I'm not sure my syslogs (I have two that appear current and then it looks like .gz backups going back) are recording anything relevant, however:

Jun 23 01:25:01 myusername /USR/SBIN/CRON[11379]: 
(root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jun 23 01:49:01 myusername -- MARK --

Just that, the hourly cron task and whatever -- MARK -- is for, all the way back. Any ideas?


Check under /var/log. Unless you have an nginx or passenger log, everything will be under syslog.

Your next step will depend on what you see there. If the solution isn't readily apparent, post your log as nginx starts cold so we can get a better clue as to where to go next.


Since you have nginx under /opt, take a look under /opt/nginx/logs/error.log.

Also, you'll want to take your app out of /root as it can cause nginx to mis-read the path if you run nginx as root.

Lastly, consider creating an nginx user to run nginx to limit your exposure to baddies.

  • What Linux/Unix distro are you running and did you install nginx via package management or source? – Shazburg Jun 23 '09 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.