WebFaction
Community site: login faq

I have nginx installed as a custom app, and use an init script similar to this: http://stackoverflow.com/questions/8019651/init-d-script-for-nginx-on-cent-os

I always used to be able to stop / start / restart it without problems.

My Nginx stopped running a couple of weeks ago (I guess there was a server restart). When I tried to start it using the init script, it wouldn't work. The relevant line in the init file is:

daemon $nginx -c $NGINX_CONF_FILE

If I try starting it without using the daemon function, i.e.

$nginx -c $NGINX_CONF_FILE

it will start fine.

There is nothing output when using the daemon function to try and start nginx. Exit code ($?) is 0. So I am not sure what the issue is.

asked 11 Jul '13, 10:48

djeyewater
2636
accept rate: 100%


Thanks very much to Christopher S from Webfaction support, who looked into this for me.

The problem was that the daemon command was getting confused with the system nginx. The fix is to supply the pidfile of my nginx

daemon $nginx --pidfile=$nginx_PID -c $NGINX_CONF_FILE

The pid also needs to be supplied to the stop function

killproc -p $nginx_PID $nginx -QUIT

A couple of other points worth noting are that the init script at http://stackoverflow.com/questions/8019651/init-d-script-for-nginx-on-cent-os wouldn't even try to start nginx because it will get confused with the system nginx. (My init script was already modified to avoid this problem).

And Webfaction already has their own nginx installer and init scripts you can use:

If you want to see the default start/stop/restart scripts that we use here at WebFaction, you can feel free to install a Passenger app from the WebFaction Control Panel: https://my.webfaction.com/new-application

The Passenger app includes a private nginx instance, as well as start/stop/restart scripts located under the ~/webapps/appname/bin/... directory.

...after you install the app, you can feel free to kill the process that gets launched, and also comment out the crontab entry (run "crontab -e" and place a # character at the beginning of the related line). That way the app doesn't use your RAM.

permanent link

answered 19 Jul '13, 11:37

djeyewater
2636
accept rate: 100%

edited 19 Jul '13, 11:37

Would you be able to submit a support ticket so we can have a closer look at this issue for you? We'll be able to provide more assistance if we can look at the actual account.

permanent link

answered 11 Jul '13, 18:58

maryh
1.3k7
accept rate: 35%

Thanks, I've done that now. I'll post back here with the answer if the issue can be resolved.

(14 Jul '13, 10:13) djeyewater
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×186
×10
×2

question asked: 11 Jul '13, 10:48

question was seen: 3,420 times

last updated: 19 Jul '13, 11:37

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM