You are not logged in.

#1 2013-09-30 16:04:43

anthillsocial
Member
Registered: 2013-02-18
Posts: 136

[SOLVED] nginx fails to start after reboot

Hi all,
I'm setting up nginx on a RaspberryPi but am having an issue where it fails to keep running.
I've installed nginx following the instructions at https://wiki.archlinux.org/index.php/Nginx and have been using the recomended perl script  "jail.pl" (https://gist.github.com/4365696) in order to set things up.

After issuing:

systemctl start nginx

nginx starts fine and i am able to view the default website via port 80. However, if I reboot the RaspberryPi and attempt to start nginx I get the following error:

systemctl start nginx
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.

I noticed that "/run/nginx.pid" doesn't exist within the main root or in the chroot location at "/srv/http/run/nginx.pid", though it does the first time run nginx. Any ideas?

Output of "systemctl status nginx.service":

nginx.service - A high performance web server and a reverse proxy server in chroot jail
   Loaded: loaded (/etc/systemd/system/nginx.service; enabled)
   Active: failed (Result: exit-code) since Mon 2013-09-30 15:47:16 GMT; 6min ago
  Process: 248 ExecStartPre=/usr/bin/chroot --userspec=http:http /srv/http /usr/sbin/nginx -t -q -g pid /run/nginx.pid; daemon on; master_process on; (code=exited, status=1/FAILURE)

Output of "'journalctl -xn', last 20 or so lines:

-- Unit UNIT has begun starting up.
Sep 30 15:47:02 PiServer systemd[239]: Reached target Default.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit UNIT has finished starting up.
-- 
-- The start-up result is done.
Sep 30 15:47:02 PiServer systemd[239]: Startup finished in 456ms.
-- Subject: System start-up is now complete
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- All system services necessary queued for starting at boot have been
-- successfully started. Note that this does not mean that the machine is
-- now idle as services might still be busy with completing start-up.
-- 
-- Kernel start-up required KERNEL_USEC microseconds.
-- 
-- Initial RAM disk start-up required INITRD_USEC microseconds.
-- 
-- Userspace start-up required 456919 microseconds.

Last edited by anthillsocial (2013-10-01 08:23:41)

Offline

#2 2013-10-01 08:23:25

anthillsocial
Member
Registered: 2013-02-18
Posts: 136

Re: [SOLVED] nginx fails to start after reboot

Just sussed out the problem, the following lines needed to be added to fstab so the the chroot jail mounted after a reboot.

/etc/fstab
--------------------------------------------------------------------------------------------------------
 tmpfs   /srv/http/run   tmpfs   rw,noexec,relatime,size=1024k   0       0
 tmpfs   /srv/http/tmp   tmpfs   rw,noexec,relatime,size=102400k 0       0

Offline

Board footer

Powered by FluxBB