Nginx warns server name has strange symbols

nginx

I have a domain that includes a dash, e.g. the-domain.com, when I made a server block with a server name of my domain and restarted nginx, I got a warning:

Restarting nginx: nginx: [warn] server name "/var/www/domain.com/www/thedomain" has strange symbols in /etc/nginx/sites-enabled/domain.com:56
nginx.

So I changed the domain to another one I have, it still continues to say the same error from above. I don't understand why it's saying this when I change it to an appropiate one?

This the repeated error:

Restarting nginx: nginx: [warn] server name "/var/www/domain.com/www/domaindir" has strange symbols in /etc/nginx/sites-enabled/domain.com:56
nginx.

My configuration file for the domain is shown below:

server {

    server_name     domain.com;

    root            /var/www/domain.com/www;
    index           index.php index.htm index.html;
    error_page      404 /404.html;
    error_page      500 502 503 504  /50x.html;

    access_log      /var/www/domain.com/logs/access.log;
    error_log       /var/www/domain.com/logs/errors.log;

    error_page 404  /index.php;

    location ~ \.php$ 
    {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/domain.com/www$fastcgi_script_name;
        include fastcgi_params;
    }
}

server {

    server_name     ~^(.+)\.domain\.com$;

    set             $file_path $1;

    root            /var/www/domain.com/www/$file_path;
    index           index.php index.htm index.html;
    error_page      404 /404.html;
    error_page      500 502 503 504  /50x.html;

    access_log      /var/www/domain.com/logs/access.log;
    error_log       /var/www/domain.com/logs/errors.log;

    location /
    {
        try_files $uri /$uri /index.php?$args;
    }

    location ~ \.php$ 
    {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/domain.com/www$fastcgi_script_name;
        include fastcgi_params;
    }
}

server {

    server_name     anotherdomain.org

    root            /var/www/domain.com/www/domaindir;  # this is line 56
    index           index.php index.htm index.html;
    error_page      404 /404.html;
    error_page      500 502 503 504  /50x.html;

    access_log      /var/www/domain.com/logs/access.log;
    error_log       /var/www/domain.com/logs/errors.log;


    location ~ \.php$ 
    {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/domain.com/www$fastcgi_script_name;
        include fastcgi_params;
    }
}

What seems to be the problem making this error thrown?

Best Answer

Easy: missing ";" after server_name at line 54.