Question

WordPress site and WP admin not reachable.

I have setup a Digital Ocean droplet with Wordpress (Ubuntu WordPress on 18.04). I configured the WordPress using SSH and also configured Letsencrypt certificates using Certbot while doing so. I also configured my wp admin username and password.

I also changed the name servers at my Domain name provider and pointed to Digital Ocean name servers where I added A record and also A record for www subdomain. If I ping my domain name it is pinging to right IP and also when I check using whatsmydns.net it shows that it is configured correctly.

I could easily access the mydomain/wp-admin and login. I changed the theme and made some layput changes. Then in Settings>General I changed the URLs to https:mydomain.com for site and wp/admin.

Now when I try to reach the site or wp-admin through web browser, I just get an error of This site can’t be reached MYDOMAIN.com refused to connect.

I added following to the wp-config file and restarted apache but still getting same error.

define ('WP_HOME','http://mydomain.com');
define ('WP_SITEURL','http://mydomain.com');

note: wherever I have mentioned MYDOMAIN in question, I have used actual domain in settings and files.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Just in case. I had a similar issue, although with a LEMP configuration. I had my Letsencrypt certificates configured with no errors, I fixed all domain names wherever I could find them in the DB and php files. My ufw settings were all fine. The DNS records were all active. I reloaded ufw and Nginx. Still, nothing worked and I had this ‘Site can’t be reached’ response from both Chrome and Mozilla. In the end I simply tried to open the site using its new domain in an incognito mode and it worked. I suppose if I used cURL to check out the URL, it would have become clear sooner and I wouldn’t have spent hours trying to figure out what was going on. So, the only problem in my case was that the browsers saved an obsolete way of accessing the site (most likely in their cookies, site settings or some other behind the scene locations) and just didn’t access the site in a proper way, although the site was up and running. Hope it helps somebody.

well, i might be able to help. You want to run your website in https, i understand, but let SSL do that. when u enable let’s encrypt ssl, it asks you if you would like to redirect all traffic etc etc to https. it will do that.

but keep your site’s url/wordpress url as http. you will still get https anyways.

coming to problem at hand, if you are not able to do it via wp-admin, i suggest go to your current theme in wp-includes or something i think and then open your theme through ftp and download functions.php , there you add those 2 string values and upload it back and see if you get access. if you do, make sure you remove the strings via ftp again from functions.php … let me know how it works out. this has happened to me several times.

Hello, @paragatipnis

Could you please confirm if the only change you’ve made is basically to switch from http to https in the Settings --> General tab in the WordPress admin panel?

I assume that with the WP_SITEURL and WP_HOME you want to revert those changes. You can also change this from the database if you have access.

You can access the MySQL console and use the following commands:

First locate both entries in the database:

select * from wp_options where option_name='siteurl';

The output should be:

+-----------+-------------+-------------------------+----------+
| option_id | option_name | option_value            | autoload |
+-----------+-------------+-------------------------+----------+
|         1 | siteurl     | https://yourdomain.com | yes      |
+-----------+-------------+-------------------------+----------+
1 row in set (0.00 sec)

To view the home value use this:

select * from wp_options where option_name='home';

The output should be:

+-----------+-------------+-------------------------+----------+
| option_id | option_name | option_value            | autoload |
+-----------+-------------+-------------------------+----------+
|         2 | home        | https://yourdomain.com | yes      |
+-----------+-------------+-------------------------+----------+
1 row in set (0.00 sec)

Then in order to change these you can execute:

update wp_options set option_value='http://yourdomain.com' where option_name='home';

If everything is okay you should see the following output:

Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

To update the siteurl use this:

update wp_options set option_value='http://yourdomain.com' where option_name='siteurl';

This should revert the changes for you.

You can also check why is this not working. To see if Apache is accepting connections on port 443 run:

netstat -plunta | grep 443

If you do not receive any output then it means Apache is not configured to accept connections on port 443 and hence you’re getting the error.

Let me know how it goes.

Regards, Alex