In your terminal type this command:

sudo apt-get install nginx

Please wait while nginx is installing in your pc.
When it is installed, type this command to start your nginx

/etc/init.d/nginx start

If ever you encountered an error below:

nginx: [emerg] bind() to failed (98: Address already in use)

It might be that there is an application that is already using that port.
So below are the possible solutions:
1. Edit the nginx.conf or default file, under this folder /etc/nginx/sites-enabled/
search the server part, listen

server {
    listen   80; #change the port 80 into 81, then saved the file and restart the nginx  

regarding Apache (Linux), using either service apache stop or service httpd stop or /etc/init.d/apache stop (or httpd) should work to stop the process, or try killall httpd or killall apache (or apache2) to stop Apache.