Recently, I have been buying VPSes with various companies to test setting up a light, fast and efficient Linux box to run some of my sites.
The typical install is Debian or Ubuntu, with the LNMP stack (Linux, nginx, MySQL and PHP). I chose nginx over Apache due to its much lower resource usage and the ability to handle much more parallel connections, should traffic spikes to the sites arise.
I realize that using plain old Apache with full caching (W3 Total Cache) is an option, but I prefer to let my sites run dynamically so that some specific plugins and code work properly (they won’t, if the site is cached).
With the choice of software decided, I installed the LEMP stack and tried to set up sites on the VPS box I had. One error that I came across was, “bind() to 0.0.0.0:80 failed (98: Address already in use)”, after I installed nginx, edited the necessary configuration files (nginx.conf among others) and restarted the nginx server using the /etc/init.d/nginx restart command.
ADVERTISEMENTI tried restarting the server, and even installed the VPS from scratch, but the error did not go away. Some poking around on the server (which included examining running processes etc.) made me realize that the error was caused by Apache being bound to the 0.0.0.0:80 port. During the LEMP stack setup, I had not removed the Apache version that was bundled with the Debian/Ubuntu template installed from the VPS management page.
The solution was easy – remove the Apache software. You can do this by issuing the apt-get remove apache2 command on Debian or Ubuntu servers. Reboot the server and nginx should be humming along nicely.