I have been following the instructions on this article:
When I enter the command on Step Seven—Start nginx I get the following error:
sudo service nginx start /etc/init.d/nginx: 2: /etc/init.d/nginx: Syntax error: newline unexpected
When inspecting the /etc/init.d/nginx file it is just an html welcome page.
I’m a newbie to nginx and don’t know how to resolve this. Can anyone provide some help?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
yes, you are getting an error 400 and that’s what is storing on the file, no the real script. What is weird is I can access the file at http://library.linode.com/assets/660-init-deb.sh so you droplet must be having trouble accessing that host from linode.
So, I will recommend you installing Nginx from a Repo, there is reason why repos exist. is to have the latest and fully functional approved package by your OS maker, maybe not the newest, but is the one they know it works like it should on your OS. pretty sure ubuntu has a pretty recent version on its repos, I use CentOs and even with a not so new version of Nginx I can be sure is pretty reliable.
Now if you still want to do as some random person suggest and use scripts and stuff modified or made by others without knowing whats on it, here is the content of the file at http://library.linode.com/assets/660-init-deb.sh
Just copy to the file manually and continue with the tutorial where you left.
try again wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh my guess is you type it wrong first time and you got a 404 error, so thats what was saved to the init-deb.sh file
This comment has been deleted
Something is wrong with your installation, try start over. also you can try: service nginx start
This comment has been deleted
Just to be clear, when you run
cat /etc/init.d/nginx
, the output is HTML? If so, there’s something wrong with your init.d script. And by wrong, I mean, completely bananas.