• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Enabling NGNIX

podman99

Basic Pleskian
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.
 
First you need to verify if ulimit is set. Try executing the command on SHELL:

echo $ulimit

What results do you get?
 
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?
 
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
 
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
 
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
 
/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
 
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

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?
 
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?

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.
 
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.

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:

2012/09/27 08:16:54 [emerg] 23771#0: bind() to X.X.X.X:80 failed (98: Address already in use)
2012/09/27 08:16:54 [emerg] 23771#0: bind() to X.X.X.X:80 failed (98: Address already in use)
2012/09/27 08:16:54 [emerg] 23771#0: bind() to [X:X:X:X::X:X]:80 failed (98: Address already in use)
...

If I stop apache and tomcat before running --enable, the output is the same. If I stop psa altogether, I get:
Unable to connect to database:

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?
 
Back
Top