1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how start lighttpd as rooot ?

Discussion in 'Site & Server Administration' started by Boten, Sep 15, 2011.

  1. #1
    Hello,

    Can anyone tell me how can i start lighttpd as root to increase the server.max-fds value ?

    According to the lighttpd documentation > http://redmine.lighttpd.net/wiki/lighttpd/Server.max-fdsDetails

    also, i don't understand what they means by : Changing this setting requires root permissions on startup ???

    Thank you :)
     
    Boten, Sep 15, 2011 IP
  2. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #2
    Did you edit lighttpd.conf and set server.max-fds to a higher number?

    server.max-fds = 4096 or 8192

    What is the output of ulimit -aH
     
    AnthonyG, Sep 15, 2011 IP
  3. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #3
    Hi mate,

    I have this error when i edit the lighttpd.conf
    Starting web server: lighttpd2011-09-15 20:12:24: (server.c.889) can't have more connections than fds/2: 500 824

    Tried also to modify :
    but always the same error...

     
    Boten, Sep 15, 2011 IP
  4. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #4
    You can place 4096 or 8192, sorry, didnt mean to confuse you, its one or the other.

    server.max-fds = 4096
    server.max-connections = 2048
    or
    server.max-fds = 8192
    server.max-connections = 4096



    Issue this command to raise the open files limit

    ulimit -n 8192

    Then restart lighty
     
    AnthonyG, Sep 15, 2011 IP
  5. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #5
    lol, cause it was mysterious.

    Tried with your two config but the same error :

    1- Starting web server: lighttpd2011-09-16 02:57:09: (server.c.889) can't have more connections than fds/2: 2048 824
    2- Starting web server: lighttpd2011-09-16 02:58:47: (server.c.889) can't have more connections than fds/2: 4096 824

    but there is a changes with your command > ulimit -n 8192

    I think the problem comes cause lighttpd is started as www-data, we need to start it as root according the documentation but how :/
     
    Boten, Sep 15, 2011 IP
  6. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #6
    Try adding the following to /etc/security/limits.conf

    www-data soft nofile 4096
    www-data hard nofile 8192

    reboot it.
     
    AnthonyG, Sep 16, 2011 IP
  7. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #7
    Same result Anthony :(

    I'm totally lost in addition to the doc lighttpd is not so clear as that, they say need to start lighttpd as root, but how to do that they do not say :eek:
     
    Boten, Sep 16, 2011 IP
  8. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #8
    It shouldnt be started as root anyways.

    server.max-fds = 256
    server.max-connections = 128

    Restart lighty, do you get the warning message with those settings?
     
    AnthonyG, Sep 16, 2011 IP
  9. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #9
    With this seting it's okay but it's something else in the errog log, i have a large site with generally 500-600 users online.

    But what do you mean by : It shouldnt be started as root anyways ?

    Lighttpd doc it's wrong ?
     
    Boten, Sep 16, 2011 IP
  10. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #10
    You shouldnt run any web server as root, apache, light, nginx or otherwise.

    server.max-fds = 8192
    server.max-connections = 4096
    server.max-worker = 4

    What results does that yield?
     
    AnthonyG, Sep 16, 2011 IP
  11. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #11
    being new in linux, that's what I say by reading the doc lighttpd, because I read somewhere that you should never run a program as root. And lighty tell to run it as root.

    1- Starting web server: lighttpd2011-09-16 19:05:02: (server.c.889) can't have more connections than fds/2: 4096 824
     
    Boten, Sep 16, 2011 IP
  12. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #12
    Change /etc/security/limits.conf to this:

    * soft nofile 4096
    * hard nofile 8192

    What are the current settings for the fastcgi conf?
     
    AnthonyG, Sep 16, 2011 IP
  13. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #13
    Same :

    1- Starting web server: lighttpd2011-09-16 19:05:02: (server.c.889) can't have more connections than fds/2: 4096 824

    The config for fastcgi is :

     
    Boten, Sep 16, 2011 IP
  14. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #14
    Ok, the fastcgi seems fine, did you reboot after changing limits.conf?
     
    AnthonyG, Sep 16, 2011 IP
  15. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #15
    Yes the fcgi are okay, i also don't have the famous 501 error.

    Yes i rebooted 3 times. (to be sure)
     
    Boten, Sep 16, 2011 IP
  16. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #16
    So your current limits.conf is this correct?

    * soft nofile 4096
    * hard nofile 8192
     
    AnthonyG, Sep 16, 2011 IP
  17. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #17
    Yes that's true :)
     
    Boten, Sep 16, 2011 IP
  18. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #18
    Whats the output of:

    sysctl fs.file-max
    or
    cat /proc/sys/fs/file-max
     
    AnthonyG, Sep 17, 2011 IP
  19. Boten

    Boten Well-Known Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    111
    #19
    # sysctl fs.file-max
    fs.file-max = 361482

    # cat /proc/sys/fs/file-max
    361482
     
    Boten, Sep 17, 2011 IP
  20. AnthonyG

    AnthonyG Well-Known Member

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    135
    #20
    Dont make much sense, without further investigation of the server, not sure why its happening at this point.
     
    AnthonyG, Sep 17, 2011 IP