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.

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.

×
2 answers

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://themoneyteam.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://themoneyteam.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

  • Hi,

    I do not want to revert to http. I want my site to run on https hence I have made those settings in wp-config file.

    I have applied a firewall and opened the port 443 for outgoing connections to all IPs.

    I reinstalled SSL certificate using sudo certbot --apache -d startup-myth.com

    Then I checked using wget https://MyDomain.com and got the index.html file in response on console.

    But when I try to access site or wp-admin using https URL, I get “This site can’t be reached” error in return.

    Thanks

    Parag

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.

Submit an Answer