Looks like your LD_LIBRARY_PATH is not set.
Try starting it up frm the command line to see if you get the same error.
Try "echo $LD_LIBRARY_PATH" to see if the directory that contains libpq.so.5 is in the LD_LIBRARY_PATH.
You might need a shell script to set LD_LIBRARY_PATH when starting nsd.
See section 5 http://openacs.org/doc/current/aolserver4.html here look for "nsd-postgres.txt" for instructions on setting it up.