These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Starting Nmap 7.01 ( https://nmap.org ) at 2017-08-25 00:38 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000017s latency).
Not shown: 2528 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 1.77 seconds
sudo nmap -sS -p 20-2550 localhost
Starting Nmap 7.01 ( https://nmap.org ) at 2017-08-25 00:38 UTC Nmap scan report for localhost (127.0.0.1) Host is up (0.000017s latency). Not shown: 2528 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 1.77 seconds
Outgoing connections on port 25 / 587 / 465 blocked
telnet smtp.gmail.com 587
Trying 74.125.24.108… Trying 74.125.24.109… Trying 2404:6800:4003:c03::6c… telnet: Unable to connect to remote host: Network is unreachable
telnet smtp.gmail.com 465
Trying 74.125.24.108… Trying 74.125.24.109… Trying 2404:6800:4003:c03::6c… telnet: Unable to connect to remote host: Network is unreachable
SSH server telnet smtp.gmail.com 465 not connect
Ubuntu LEMP on 16.04
Debug the error and then give us the full error you are getting.