@amanabdulalim
There could be a number of things associated with that error, ranging from local connection issues to your IP being blocked by the web servers firewall, with a few other potential in-between.
So, let’s start with a few basic questions:
1). Are you able to login to the web server as root
or your sudo
user (i.e. SSH)?
2). Can you connect to your server using SFTP and access your web root?
If no to the above, chances are that your IP has been blocked if there’s an active firewall. That would definitely explain why you can access the website from other locations but not your own. To unblock your IP, there’s only a few options.
Option #01: Login to as root
via SSH from another location and from the command line, run:
sudo ufw status
If that returns enabled, then run:
sudo ufw disable
For security, you don’t want to permanently disable the firewall, but if your IP is blocked, this should allow you to get back in.
Option #02: Contact DigitalOcean Support by submitting a support ticket from the control panel and let them know that your IP appears to be blocked and that you would like to see if they can login to the server and remove the block for you.
NOTE: If you’ve setup an SSH Key on the Droplet, you may be forced to do #01 though as their support team may not be able to login since your Droplet wouldn’t be setup with a root password and root login at that point, would be disabled.
Restarting Your Web Server
If your IP isn’t blocked, try restarting the web server using either:
service apache2 restart
or, if you’re using NGINX,
service nginx restart
Delete the .htaccess File
In some cases, the .htaccess file used by Apache and created by WordPress can create issues. The easiest thing to do in such a potential case is to simply delete it and them login to the WordPress Admin and simply save your permalinks. By clicking save, it’ll generate a new .htaccess file for you with the correct parameters.
Check Server Logs
If your IP isn’t blocked and the web server doesn’t seem to be the issue, we need to fall back and check your log files. Since you’re using WordPress, there should be an error log in your home directory (i.e. where index.php resides for your WordPress installation). We should check the last 20-30 lines of that file to see if we can identify another issue.