Hello,
Trying to install nginx with modsecurity module on an Amazon LightSail VPS has encountered the error: “g++: internal compiler error: Killed (program cc1plus)”
The main issue is that VPS has only 512MB RAM which seems not to be enough for compilation process.
As surely the upgrade to 1GB RAM could help, there is also an alternative to increase temporarily the swap on the VPS
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000 mkswap /var/swap.img swapon /var/swap.img
After enabling this, the compilation was successful.
Note: Debian 9 Stretch, Amazon LightSail, 512MB RAM, 20GB SSD