I have a server that is close to new and having a problem with getting nginx to start as expected. I have configured another server basically the same way and it works there. I figure there must be some environmental difference between the two, but I haven't been able to find it.
The short version:
Starts - sudo nginx
Fails - sudo service nginx start
Fails - sudo service nginx restart
works - sudo service nginx stop
When the commands fail they don't really say anything beyond:
* Restarting nginx nginx [fail]
Nothing else in the log files(nginx[access or error], syslog) or written to screen
More details:
Both say the config file is OK
sudo service nginx configtest
sudo nginx -t
I checked the permissions for nginx.conf and they are OK (same as working server) Double checked that www-data had access to the log files and such and it does
The /etc/init.d/nginx file is the same on both servers and so is the command used (see above)
The log files do exist
user/group www-data does exist
Ubuntu 12.04 LTS
nginx 1.6
Ran the requested - sudo strace service nginx start on each erver Other than the first piece below, the only other differences I saw between running on the two different servers were things like pointers and the PID. I prefixed the two lines per set that are different with ***
==== The one that works
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd6076a09d0) = 24394
close(4) = 0
*** read(3, "/run/nginx.pid\n", 128) = 15
(… snip till the bottom…)
*** rt_sigreturn(0x11) = 24396
dup2(11, 2) = 2
close(11) = 0
read(10, "", 8192) = 0
exit_group(0) = ?
=============== The one that fails
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f067e79d9d0) = 21761
close(4) = 0
*** read(3, "/run/nginx.pid\nserver_name\n", 128) = 27
(… snip till the bottom…)
*** rt_sigreturn(0x11) = 21763
dup2(11, 2) = 2
close(11) = 0
read(10, "", 8192) = 0
exit_group(0) = ?