For nginx, you need to change the configuration file
/usr/local/etc/nginx/nginx.conf
If your root wordpress is not the webroot but http://domain.com/wordpress/:
location /wordpress/ {
try_files $uri $uri/ /wordpress/index.php?q=$uri$args;
}
On server
location / {
try_files $uri $uri/ /index.php?q=$uri$args;
}