Suspicious symbols on nginx config

I have the following nginx config, e.g.

server {
        listen   80;
        server_name example.com
        allow 127.0.0.0/8;

When I restart, it warn me:

Restarting nginx: nginx: [warn] server name "127.0.0.0/8" has suspicious 
symbols in /etc/nginx/sites-enabled/xxx

Any idea?


I guess you are missing the ; at the end of the server_name directive so it interprets the allow line as part of the server name.

server {
        listen   80;
        server_name example.com;
        allow 127.0.0.0/8;

For me the cause of this error was having 'http://' in the server_name.

i.e. I changed this:

server {
    listen <Server name>:80;
    server_name <DNS name> http://localhost:28080;
    ...

To this:

server {
    listen <Server name>:80;
    server_name <DNS name> localhost:28080;
    ...

A simple directive consists of the name and parameters separated by spaces and ends with a semicolon (;).

In your case server_name example.com semicolon (;) is missing.

server {
        listen   80;
        server_name example.com;
        allow 127.0.0.0/8;