0

Following the instructions here: https://www.digitalocean.com/community/articles/how-to-deploy-rails-apps-using-passenger-with-nginx-on-centos-6-5

I get to the point of "Use vim /etc/init.d/nginx to create the start/restart/stop script for nginx" but I can't get the server to start after creating this file and giving it permission to execute. I just get the error env: /etc/init.d/nginx: No such file or directory but I can clearly see that the file is where it is supposed to be.

When I try to start nginx directly using /etc/init.d/nginx start I get the error -bash: /etc/init.d/nginx: /bin/sh^M: bad interpreter: No such file or directory.

What could be causing this?

4
  • Be careful what text editors you use on your local Windows computer. Apr 25, 2014 at 2:45
  • I'm using RubyMine 6.3.1. Bad idea?
    – eComEvo
    Apr 25, 2014 at 2:47
  • You used that to create the /etc/init.d/nginx file? Apr 25, 2014 at 2:47
  • Yep. I changed the line ending for new files to unix style (\n) and recreated the file from scratch. Now it works. Thanks for cluing me in! Add as answer if you want me to accept it.
    – eComEvo
    Apr 25, 2014 at 2:50

1 Answer 1

0

Be careful what text editors you use on your local Windows computer. Some create Windows-style line endings (\r\n, CR-LF), which cause problems like this on Unix-like systems such as Linux or Mac OS X.

If you use such an editor, adjust its settings so that it creates files with Unix-style line endings. If the editor has no such setting, you should not be using it at all.

You must log in to answer this question.

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