Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed nginx via passenger for running ruby on rails applications.

I added the this script: RedHat Nginx Init Script

Changed paths for nginx and config to where they are located:

nginx="/opt/nginx/sbin/nginx"

NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"


When I try to run a command (for example service nginx start) I get this:

env: /etc/init.d/nginx: Permission denied



As I searched for an awnser I stumbled something that said that I had to make the scrpit executable with chmod

chmod +x /etc/init.d/nginx



When I now run service nginx start nginx does start, but my terminal stops at this and I have to Ctrl+c to be able to type again.

Starting nginx (via systemctl):  



When i run service nginx stop I get this, even though nginx continues to run.

Stopping nginx (via systemctl):                            [  OK  ]

Same goes for service nginx reload, it tells my [ OK ] but it's not reloading.

Reloading nginx configuration (via systemctl):             [  OK  ]



This is what I get when I run service nginx status

nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
  Loaded: loaded (/etc/rc.d/init.d/nginx)
  Active: inactive (dead) since Thu, 25 Apr 2013 13:01:43 +0000; 5min ago
 Process: 890 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=0/SUCCESS)
  CGroup: name=systemd:/system/nginx.service
      ├  930 PassengerWatchdog
      ├  933 PassengerHelperAgent
      ├  935 Passenger spawn server
      ├  941 PassengerLoggingAgent
      ├  970 nginx: master process /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
      ├  971 nginx: worker process
      ├  977 Passenger ApplicationSpawner: /srv/www/ptw-temp
      ├  983 Rack: /srv/www/ptw-temp
      ├  986 Passenger ApplicationSpawner: /srv/www/pt-temp
      ├  994 Rack: /srv/www/pt-temp
      ├ 1003 Rack: /srv/www/pt-temp
      └ 1011 Rack: /srv/www/ptw-temp

Apr 25 13:00:07 chronus nginx[890]: -o, --non-unique              allow to create users with duplicate
Apr 25 13:00:07 chronus nginx[890]: (non-unique) UID
Apr 25 13:00:07 chronus nginx[890]: -p, --password PASSWORD       encrypted password of the new account
Apr 25 13:00:07 chronus nginx[890]: -r, --system                  create a system account
Apr 25 13:00:07 chronus nginx[890]: -R, --root CHROOT_DIR         directory to chroot into
Apr 25 13:00:07 chronus nginx[890]: -s, --shell SHELL             login shell of the new account
Apr 25 13:00:07 chronus nginx[890]: -u, --uid UID                 user ID of the new account
Apr 25 13:00:07 chronus nginx[890]: -U, --user-group              create a group with the same name as the user
Apr 25 13:00:07 chronus nginx[890]: -Z, --selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping
Apr 25 13:00:07 chronus nginx[890]: Starting nginx: [  OK  ]



I need to get these commands working properly! Would appreciate some help!

share|improve this question
    
I imagine all these commands are run as root right? What happens if you run this (again, as root): daemon /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf? –  terdon Apr 25 '13 at 13:48
    
Yes @terdon I've been doing everything as root. I ran the line you wrote and got this: -bash: daemon: command not found –  Patrik Thorsson Apr 25 '13 at 13:53
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.