You may want this:
sed -ri '/location \//,/.*\}/d' /opt/nginx/conf/nginx.conf
-r, --regexp-extended
use extended regular expressions in the script (.*)
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)