Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed NGINX using this tutorial:

C3M Digital NGINX Tuturial

but after reading this article on security issues with "cut and paste" configuration tutorials:

Neal Poole's article regarding security and NGINX configuration

I decided to follow Poole's suggestion to use the configuration suggested in the WordPress codex:

Codex on NGINX Configuration

I used the Codex configuration for a multisite installation using W3 Total Cache. When attempting to start NGINX I get an error saying that the /etc/nginx/nginx.conf test failed. The error message was:

"Restarting nginx: nginx: [emerg] unknown directive "//" in /etc/nginx/sites-enabled/"

When I looked at my site specific configuration at that path I noticed the rewrite rule in the server block was:

rewrite ^ $scheme://teambrazil.conf$request_uri redirect;

That line in the Codex example was:

rewrite ^ $scheme://mysite.conf$request_uri redirect;

That looked like a mistake to me, and I changed my line to:

rewrite ^ $scheme://$request_uri redirect;

I then attempted to restart NGINX but got the same error message.

My question is: is that a mistake, and is there anything more I have to do aside from restarting NGINX after making this change.

As suggested by both tutorials I set up the directories: /etc/nginx/sites-enabled and /etc/nginx/sites-available and created the appropriate symbolic links using:

touch /etc/nginx/sites-available/
ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

Is there something else I need to consider after making this correction? Or was it not an error in the first place? I'm pretty stuck here.

BTW, I am using Debian squeeze as an OS on Amerinoc's VPS. I'm just getting familiar with VPS administration and am pretty much a noob.

Thanks very much, would appreciate any input.

share|improve this question
At a glance (and just a guess at the moment) - I would say it is the problem of copy and paste you mention. There are two lines in the per site configuration section that start with "//": // Additional rules go here. and // Only include one of the files below. They are intended to be replaced and so need to be removed. Nginx uses '#' as the comment sign, so // is not valid. If that isn't the issue, post your full configuration and hopefully you can get a few more suggestions. – cyberx86 Jun 10 '12 at 21:07
Cyberx86, thank you! I had no idea, assumed, like PHP the "//"s were valid for single line comments. I made the changes and ended up with a 502 bad gateway error. But at least NGINX restarted! – jw60660 Jun 10 '12 at 21:14
up vote 1 down vote accepted

The Wordpress Codex includes two lines in the Per Site Configuration section that start with "//":

  • // Additional rules go here
  • // Only include one of the files below

Both of these lines are meant as placeholders, and need to be removed and replaced with appropriate configurations.

Nginx uses '#' as the comment sign, so '//' is not valid. In general, you will find that 'directives' start a line - therefore the error 'unknown directive "//"' suggests that there is a line starting with '//' which Nginx is trying to interpret as a directive (and since it isn't a valid directive, Nginx throws an error).

share|improve this answer

Your Answer


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.