Subprocess installed post-installation script returned error exit status 247 for gconf2

Solution 1:

Setting up gconf2 (2.28.1-6) ...
dpkg: error processing gconf2 (--configure):
 subprocess installed post-installation script returned error exit status 247

This means that the postinst script for the gconf2 package failed. You can check why using:

dpkg --configure -D 777 gconf2

You can also run the postinst script yourself:

sh -x /var/lib/dpkg/info/gconf2.postinst configure 2.28.1-6

And figure out what's wrong.

Solution 2:

find your packages package.postinst file in /var/lib/dpkg/info directory and remove

#
character before
set -x
and fire
dpkg --configure package
command and see what happens.

Solution 3:

Then try

sudo apt-get purge nginx
sudo apt-get autoremove

to completly remove the package and then type

sudo apt-get purge nginx-*

to install it again