First, we should install Nginx. We want it to listen on the default HTTP ports, so we should ensure that they are not already taken by some other service. Performing this command should result in an error, as follows:
$ curl http://localhost curl: (7) Failed to connect to localhost port 80: Connection refused
If not, you should disable or remove that service to allow Nginx to use those ports. For example, to stop an existing Apache server, you should use this command:
$ sudo service apache2 stop
Better yet, you should consider removing it from your system, or reconfigure it to listen on another port, so that the HTTP and HTTPS ports (80 and 443) are free to be used by Nginx.
Now we can install Nginx, which ...