I am experiencing a very peculiar problem with my Raspberry Pi 3 (model B V1.2), running the latest version of Raspbian (the June 2017 version).
Whenever I try to install
apt-get, my Pi reboots (after one failure, this results in having to execute
dpkg --configure -a which also causes the Pi to reboot). I only have this problem using nginx; I can install apache (another webserver), do upgrades, install any other package except nginx.
When I tried putting the
dpkg --reconfigure -a command in my /etc/rc.local, the device effectively got stuck in a boot loop.
At first I thought the image/OS was corrupt, since this might occur, but the problem persists across fresh reinstalls.
After some searching I found it might be a problem with the power supply; it is connected to an outlet using my Samsung cellphone charger.
I have checked cpu/memory usage, and it's nowhere near noteworthy.
I fixed it by plugging the sd-card in my other Raspberry Pi 2; that Pi seems to be capable of actually installing
nginx to the sd-card which I can afterwards plug back in my original Raspberry Pi 3.