nginx-init-ubuntu icon indicating copy to clipboard operation
nginx-init-ubuntu copied to clipboard

Script for Ubuntu 16.04 systemd

Open amkgo opened this issue 9 years ago • 6 comments

This is for Ubuntu 14.04 upstart script. Do you have any plan to update it for Ubuntu 16.04 to use systemd script.

Thanks. Andrew

amkgo avatar May 12 '16 05:05 amkgo

Yes absolutely LTS is on the road map. Should have it done by end of the month.

-Jason

On May 12, 2016, at 1:42 AM, AMK [email protected] wrote:

This is for Ubuntu 14.04 upstart script. Do you have any plan to update it for Ubuntu 16.04 to use systemd script.

Thanks. Andrew

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

JasonGiedymin avatar May 14 '16 06:05 JasonGiedymin

Great, thanks.

amkgo avatar May 14 '16 06:05 amkgo

+1

deweydb avatar Jun 20 '16 22:06 deweydb

Possibly related to this particular issue is that the script hangs for me on Ubuntu Server 16.04 LTS:

# /etc/init.d/nginx start
[....] Starting nginx (via systemctl): nginx.service
^C  <-- Waited for at least a minute before killing the script and yet...
# ps aux | grep nginx
root      3121  0.0  0.0  49312  3084 ?        Ss   21:22   0:00 nginx: master process /usr/local/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
www-data  3122  0.0  0.0  49312  5300 ?        S    21:22   0:00 nginx: worker process
www-data  3123  0.0  0.0  49312  5300 ?        S    21:22   0:00 nginx: worker process
# cat /etc/default/nginx
DAEMON=/usr/local/sbin/nginx
PIDSPATH=/var/run
# cat /var/run/nginx.pid
3121

On the flip side, a php-fpm init.d script I've used unchanged since Ubuntu 12.04 LTS still works great. I was using the 2009 version of this nginx init.d script, ran into the same script hanging issue, and updated to the latest version of this script in the hope that it would fix the issue. As evidenced above, it didn't.

Also of note: /etc/init.d/nginx stop does not actually stop anything. It immediately exits and says [ ok ] Stopping nginx (via systemctl): nginx.service.. service nginx stop also does nothing.

My configure line for nginx is:

./configure --pid-path=/var/run/nginx.pid --sbin-path=/usr/local/sbin --with-http_ssl_module

Nothing fancy there.

July 2016 marks the release of 16.04.1 LTS. At that point, 16.04 LTS becomes generally available to all LTS users - of which, I'd wager most are running servers. I suspect there will be a LOT more +1's on this issue shortly after that happens.

cubiclesoft avatar Jun 23 '16 04:06 cubiclesoft

FYI, I switched over to this script:

https://github.com/Fleshgrinder/nginx-sysvinit-script

From an active contributor on PHP internals and an officially recognized repo from the nginx side of things. Also, the script actually works out-of-the-box (I only had to configure the pid file) on Ubuntu 16.04 LTS. I'm not a fan of running make on an init.d script, but the makefile doesn't really do much.

cubiclesoft avatar Jun 23 '16 05:06 cubiclesoft

I got an start up error of the nginx init script: PID file /usr/local/nginx/logs/nginx.pid not readable (yet?) after start: No such file or directory

Though, I tried modifying the init script and have configured nginx with: --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock

The script mentioned by @cubiclesoft did very well without the need of modification but I am missing the console feedback as it's given in this script on start, restart, stop etc.

mikeg-de avatar Oct 12 '16 20:10 mikeg-de