Suspicious symbols on nginx config

Solution 1:

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;

Solution 2:

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;
    ...

Solution 3:

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;

Tags:

Nginx