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!

4
  • 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, 2014 at 8:28
  • What do you mean? It's an executable, but sadly it's also permission denied with sudo. Jan 25, 2014 at 8: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 <command> Jan 25, 2014 at 8:53
  • I am using the root user. So normally sudo isn't needed. Jan 25, 2014 at 8:55

2 Answers 2

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.

3
  • Init scripts are supposed to run...
    – vonbrand
    Jan 25, 2014 at 19:04
  • I used ’which nginx’ but it didn't help. It doesnt output anything. Jan 26, 2014 at 20:20
  • Are you using the /opt prefix (default for you) or /etc? Because if you chose somewhere non-standard you may need to manually edit /etc/init.d/nginx so that the path to nginx binary is correct.
    – Richard
    Jan 29, 2014 at 14:46
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).

3
  • As written before, I installed Nginx through Phusion Passenger Jan 26, 2014 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, 2014 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. Jan 27, 2014 at 20:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .