Changing Nginx root is not working

I have created a LEMP stack ubuntu server on digital ocean and cannot get it to point to my application.

When i go to my servers IP address it goes to an index.php file inside /var/www/html however I want it to point to /var/www/itom/public.

This is my nginx config file

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/itom/public;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name 138.68.135.117;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

I have restarted nginx with

service nginx restart

Any ideas guys?

Your root needs to reside in a location stanza. In your case it should look like:

location / {
    root   /var/www/itom/public;
    index  index.php index.html index.htm index.nginx-debian.html;
}

Your

try_files $uri $uri/ =404;

does not need to be in the location stanza

Hope this helps.