1

I searched on the internet for a while now and I don't find a solution so I am asking here: My question is, why is this file (/etc/init.d/nginx) not executeable?

I was following the tutorial of Alex yesterday and I got into an issue. Everything worked until the service nginx restart-command. When I try to run this command I will get

 nginx: You don't have permissions to execute nginx.

After googling some time I found a potential answer, but this was already done in the tutorial/walkthrough of Alex:

 $ sudo chmod +x /etc/init.d/nginx

Some info if you don't want to read the tutorial:

  • I am using Nginx (as you will know when reading this bit)
  • It's installed it with Passenger and then imported a Nginx Init-script and the nginx.conf file from scratch.
  • Oh and I am running Debian instead of Ubuntu, but that shouldn;t be the problem, or?

So I would be very thankful if anyone could help me. Thanks!

Dominik Schmidt
  • 111
  • 1
  • 3
  • 1
    had `/etc/init.d/nginx` been executabe, then you'd been able to run the service script without permission denied. Check `ls -l /etc/init.d/nginx` and you'll see that it's not. – Petter H Jan 25 '14 at 08:28
  • What do you mean? It's an executable, but sadly it's also permission denied with sudo. – Dominik Schmidt Jan 25 '14 at 08:40
  • I am no nginx guy. Few questions, as which user you are running the webserver when you are restarting and can you strace the failed step please. And by that, I mean this, strace -ffttTo /tmp/strace.out – Soham Chakraborty Jan 25 '14 at 08:53
  • I am using the root user. So normally sudo isn't needed. – Dominik Schmidt Jan 25 '14 at 08:55

2 Answers2

1

First /etc/init.d/nginx is actually a init script, not an executable file. You could try to locate the nginx binary and start it manually and check the permissions.

Run whereis nginx to find the binary.

Richard
  • 56
  • 2
0

How did you install nginx? Have you made sure that you didn't skip a step somewhere?

If you installed it by hand from sources, why? Isn't a package available for your Linux distribution/other Unix? Going the "install from sources" route isn't a good idea (your system doesn't know about it and its dependencies; also you are shouldering the burden of keeping up with bugs/security issues, which are specially critical for Internet-facing services).

vonbrand
  • 1,149
  • 2
  • 8
  • 16
  • As written before, I installed Nginx through Phusion Passenger – Dominik Schmidt Jan 26 '14 at 20:20
  • @DominikSchmidt, why don't you use the Debian package? They know what they are doing, and the correct installation is critical for a Internet-facing sevice... – vonbrand Jan 27 '14 at 13:07
  • Sure, but I am working in a serious web development studio and they are also doing it this way. Passenger is installing a Nginx installation from scratch. – Dominik Schmidt Jan 27 '14 at 20:28