Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
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 at 8:28
    
What do you mean? It's an executable, but sadly it's also permission denied with sudo. –  Dominik Schmidt Jan 25 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> –  Soham Chakraborty Jan 25 at 8:53
    
I am using the root user. So normally sudo isn't needed. –  Dominik Schmidt Jan 25 at 8:55

2 Answers 2

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.

share|improve this answer
    
Init scripts are supposed to run... –  vonbrand Jan 25 at 19:04
    
I used ’which nginx’ but it didn't help. It doesnt output anything. –  Dominik Schmidt Jan 26 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 at 14:46

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).

share|improve this answer
    
As written before, I installed Nginx through Phusion Passenger –  Dominik Schmidt Jan 26 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 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 at 20:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.