1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Enabling NGNIX

Discussion in 'Plesk 11.x for Linux' started by podman99, Aug 23, 2012.

  1. podman99

    podman99 Basic Pleskian

    23
    57%
    Joined:
    Sep 23, 2007
    Messages:
    47
    Likes Received:
    0
    When we enable NGNIX (things obviously take a while, so that configs can be updated).

    However, after a few minutes of waiting, I get a message back about failure todo with too many files open.

    This is quite odd, as Apache2 is offline at this point (to my knowledge), so no serving of web pages or handling log files.

    Also I have enabled pipelog, and re-compiled and installed the file descriptor limit (and support have also compiled for me before my upgrade to plesk 11).

    Currently have 1063 domains so too many files is no supprise, however after recompiling apache, and stuff (not ngnix???) its a little odd that it still does this.

    Should NGNIX be re-compiled.?

    Currently this server is running plesk 11.0.9 #9 on Ubuntu 10.04.4 LTS now I do know that a fresh install with ubuntu 12.04 does not have this issue, but 12.04 has a different FD limit from distro.

    Perhaps there are some suggestions to improve.
     
  2. abdi

    abdi Platinum Pleskian

    31
    18%
    Joined:
    May 14, 2006
    Messages:
    2,913
    Likes Received:
    60
    First you need to verify if ulimit is set. Try executing the command on SHELL:

    echo $ulimit

    What results do you get?
     
  3. podman99

    podman99 Basic Pleskian

    23
    57%
    Joined:
    Sep 23, 2007
    Messages:
    47
    Likes Received:
    0
    Thanks for the reply abdi.

    Results from several commands below

    root@ydns:~# echo $ulimit

    root@ydns:~# ulimit
    unlimited
    root@ydns:~# ulimit -n
    1024
    root@ydns:~# crontab -l | grep ulimit
    */5 * * * * ulimit -n 16384
    root@ydns:~# cat /etc/sysctl.conf | grep -v \#
    fs.file-max = 70000
    root@ydns:~#


    Perhaps this will shed some light, by -n ulimit does not appear to be as set by my 5 minute cron which may have something to do with it?
     
  4. abdi

    abdi Platinum Pleskian

    31
    18%
    Joined:
    May 14, 2006
    Messages:
    2,913
    Likes Received:
    60
    Try a higher value, try executing the command:

    ulimit -n 131072

    In order to make this change permanent

    vim /etc/sysctl.conf

    and add following lines

    fs.file-max = 131072

    Then,

    /sbin/sysctl -w fs.file-max=131072

    mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e "replace into misc (param,val) values ('apache_pipelog', 'true');"

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

    /etc/init.d/httpd restart
     
  5. podman99

    podman99 Basic Pleskian

    23
    57%
    Joined:
    Sep 23, 2007
    Messages:
    47
    Likes Received:
    0
    That seems to have done it although the response when enabling NGINX is not very pretty??

    root@ydns:~# ulimit -n 131072
    root@ydns:~# vi /etc/sys
    sysctl.conf sysctl.d/ sysstat/
    root@ydns:~# vi /etc/sysctl.conf
    root@ydns:~# /sbin/sysctl -w fs.file-max=131072
    fs.file-max = 131072
    root@ydns:~# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e "replace into misc (param,val) values ('apache_pipelog', 'true');"
    root@ydns:~# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
    root@ydns:~# /usr/local/psa/admin/sbin/nginxmng -e
    /opt/psa/admin/sbin/hmmng: 1447: Syntax error: Bad fd number <-------- That does not look good???

    But I can confirm that a website hosted on that server is now being distributed via NGINX
     
  6. podman99

    podman99 Basic Pleskian

    23
    57%
    Joined:
    Sep 23, 2007
    Messages:
    47
    Likes Received:
    0
    Umm... the plot thickens :(

    I have just had a call from a customer saying their site does not work.

    A site does respond, however not theirs, it appears to break somewhere through the configuration.

    keithjasper.co.uk (mine) works, however watchbattery.co.uk show another site hosted on that server? Appears nginx is pulling from the wrong vhost or apache is distroburing the wrong files?

    I have ran /usr/local/psa/admin/bin/nginxmng -d and now things are back to normal, however without nginx being used to distribute content. :(

    Thanks
     
  7. abdi

    abdi Platinum Pleskian

    31
    18%
    Joined:
    May 14, 2006
    Messages:
    2,913
    Likes Received:
    60
    /usr/local/psa/admin/bin/nginxmng --enable should resolve the Nginx problem not showing some sites. Basically it enables Nginx but also regenerates vhosts which if you don't need Nginx you can resolve the problem still with:

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
     
  8. brianmc

    brianmc New Pleskian

    15
    85%
    Joined:
    Jan 24, 2011
    Messages:
    6
    Likes Received:
    0
    I'm seeing the same response:

    # /usr/local/psa/admin/bin/nginxmng --enable
    /opt/psa/admin/sbin/hmmng: 1447: Syntax error: Bad fd number
    # /etc/init.d/nginx status
    * could not access PID file for nginx
    # /etc/init.d/nginx start
    * Not starting NGINX as it is disabled in config

    We upgraded from Plesk 10.0.9 to 11.0.9, on Ubuntu 10.04. Any suggestions?
     
  9. Nikolay.

    Nikolay. Silver Pleskian

    17
    35%
    Joined:
    Jul 1, 2012
    Messages:
    844
    Likes Received:
    2
    Unfortunately, hmmng is not fully dash-compatible. To fix this error you should either use bash instead of dash system-wide (i.e. symlink /bin/sh should point to bash, not dash), or just fix /usr/local/psa/admin/sbin/hmmng first line to be "#!/bin/bash" (without quotes).

    Nginx refuses to start, since enabling it failed (maybe due to hmmng error, but I guess not).

    A good way to fix the descriptors issue is to adjust /etc/security/limits.conf - add entries for following users: root, psaadm, www-data, nginx. The first two are optional, but I'm not 100% sure. IIRC, the limit value should be at least 3 times bigger than amount of virtual hosts you have. Also you don't need piped logs if you adjust the limits.

    Please note that this files sets limits for a session. Therefore after editing the file you should either reboot the server (this is the easiest way, but may be unacceptable), or relogin, restart panel, Apache and NGINX services, and if you have Watchdog enabled, disable it until next reboot (you can try to reenable it right away, but I'm not sure it will not be spawned by init, in which case limits for processes restarted by WatchDog will revert to the old ones).

    Hope this helps.
     
  10. brianmc

    brianmc New Pleskian

    15
    85%
    Joined:
    Jan 24, 2011
    Messages:
    6
    Likes Received:
    0
    Thanks for the bash tip Nikolay, solved the hmmng error.

    Nginx enable is failing because it cannot bind to port 80/443. When I run enable, this appears in the Nginx logs:

    If I stop apache and tomcat before running --enable, the output is the same. If I stop psa altogether, I get:
    It seems that when I try to enable nginx, it cannot happen due to apache running. But apache is started by the enable process. How do I get around this?
     
Loading...