If you have domain or host for instance ataraza.com and you want to run codeigniter in sub folder like /{root}/subfolder1/subfolder2/codeigniter then add follow configuration in /etc/nginx/sites-available/default.
location /subfolder1/subfolder2/codeigniter/
{
if ($request_uri ~ "^system.*"){
rewrite ^/subfolder1/subfolder2/codeigniter/(.*)$ /subfolder1/subfolder2/codeigniter/index.php?/$1 last;
}
if (!-e $request_filename){
rewrite ^/subfolder1/subfolder2/codeigniter/(.*)$ /subfolder1/subfolder2/codeigniter/index.php?/$1 last;
}
}
Sudo commands are
sudo nano /etc/nginx/sites-available/default (To Edit default configuration file. Use shortcut ctrl+o to write and ctrl+x to save with Y and exit with enter)
sudo service nginx restart (To restart nginx after the changes)