Após algumas pesquisas e alguns erros, aqui está a solução. A pegadinha que eu encontrei é usar " link $ uri". Inserir um / na frente de $ uri resulta em um redirecionamento para o link
server {
listen 80;
server_name www.example.com;
rewrite ^ http://example.com$uri permanent;
}
# the server directive is nginx's virtual host directive.
server {
# port to listen on. Can also be set to an IP:PORT
listen 80;
# Set the charset
charset utf-8;
# Set the max size for file uploads to 10Mb
client_max_body_size 10M;
# sets the domain[s] that this vhost server requests for
server_name example.com;
# doc root
root /var/www/example.com;
# vhost specific access log
access_log /var/log/nginx_access.log main;
# set vary to off to avoid duplicate headers
gzip off;
gzip_vary off;
# Set image format types to expire in a very long time
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires max;
}
# Set css and js to expire in a very long time
location ~* ^.+\.(css|js)$ {
access_log off;
expires max;
}
# Catchall for everything else
location / {
root /var/www/example.com;
access_log off;
index index.html;
expires 1d;
if (-f $request_filename) {
break;
}
}
}