User to start Passenger (with Nginx)

10,259

Solution 1

Put the following into your nginx.conf in the http block:

passenger_default_user custom_username;
passenger_default_group custom_group;

You can find more configuration options here:

http://modrails.com/documentation/Users%20guide%20Nginx.html#PassengerDefaultUser

Solution 2

At one point the user and group were determined by the owners of the config.ru file. I'm pretty sure this is still the case.

Share:
10,259
ceth
Author by

ceth

I'm a programmer, occasional SRE, Unix automator. I'm currently working primarily in Go, and prior to that my weapon of choice was Python, but I'm also familiar with Java, C#, JavaScript, and bash. I dabble in Clojure and F# but I've never thrown a big problem at it. I run Linux at home and at work but that doesn't mean I'm ignorant of other systems :)

Updated on August 06, 2022

Comments

  • ceth
    ceth over 1 year

    I have Nginx with Passenger. In nginx.conf I have line:

    user pass users;
    

    and Nginx process works on 'pass' user, but Passenger* processes work on 'nobody' user.

    I can run Passenger standalone:

    sudo passanger start -e production -p 80 --user=pass
    

    How can I run Passenger with Nginx with my custom user?

  • ceth
    ceth almost 13 years
    If I understood correctly your answer - I have user line in my nginx.conf (see my question). And Nginx stats for this user, but passenger doesn't.
  • ceth
    ceth almost 13 years
    I post the question regarding Nginx and Passenger on ServerFault, but didn't get any answer. :(
  • ceth
    ceth almost 13 years
    Here is the question serverfault.com/questions/276228/…. It is different, but I think that the problem is user rights.
  • Devin M
    Devin M almost 13 years
    hmm, well does my answer fix the problem for you?
  • ceth
    ceth almost 13 years
    No, doesn't. I have user line in my nginx.conf (see my question). And Nginx stats for this user, but passenger doesn't.
  • Devin M
    Devin M almost 13 years
    why cant you chown the files?
  • sqreept
    sqreept over 10 years
    Saved my day :). Why is that?
  • eltiare
    eltiare over 10 years
    I think it's to enable writing in the Rails directory if your scripts need it. It's fairly safe to assume that if the config.ru file has certain permissions the rest will have them, too.
  • rodvlopes
    rodvlopes over 3 years
    when the owner is root, it will run as nobody