SSH connection refused

After command -
ssh ubuntu@ -L8888:localhost:8888
i am getting this error message- ssh: connect to host port 22: Connection refused

Are you conncecting using a proxy ?

Could you share how you setup this machine?

It could be that there is no firewall rule

yes ,i am connecting to a proxy

So there could be a case of your institution refusing connection through ssh port -22. My college does block any traffic through port 22. To check whether this is the issue I suggest you to connect to your instance using mobile data. If you can not connect using mobile data as well then as @npatta01 said you should check firewall rules.

Is this an amazon/google cloud/paperspace server ?
If it turns out that port 22 is blocked, you may still be able to use jupyter notebook from that server.
For paperspace/google cloud you could use their web shell to connect to the machine and start jupyter.