# Localhost site cannot be reached. ERR\_CONNECTION\_REFUSED

**URL:** <https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577>\
**Category:** Installation\
**Created:** [July 3, 2020, 9:04am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577 "2020-07-03T09:04:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 3, 2020, 9:04am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/1 "2020-07-03T09:04:05Z")

</div>

Hello. After running the write freely executable, I get this:

```auto
2020/07/03 08:21:34 Starting WriteFreely 0.12.0...
2020/07/03 08:21:34 Loading config.ini configuration...
2020/07/03 08:21:34 Loading templates...
2020/07/03 08:21:34 Loading pages...
2020/07/03 08:21:34 Loading user pages...
2020/07/03 08:21:34 Loading encryption keys...
2020/07/03 08:21:34 Connecting to mysql database...
2020/07/03 08:21:34 Adding {domain} routes (single user)...
2020/07/03 08:21:34 Going to serve...
2020/07/03 08:21:34 Serving on http://localhost:8080
2020/07/03 08:21:34 ---

```

Then I try to access `http://localhost:8080` on my chrome browser and it tells me the site cannot be reached. It gives me a `ERR_CONNECTION_REFUSED` error. I assume it is supposed to show the default home page for the blog.

I tried clearing my browsing data, but that didn’t help. I also tried resetting permissions for `localhost:8080` on chrome, but that didn’t work as well.

Any ideas?

---

<div class="post-metadata">

**Author:** ![cjeller1592](https://discuss.write.as/user_avatar/discuss.write.as/cjeller1592/32/128_2.png) [@cjeller1592](https://discuss.write.as/u/cjeller1592)\
**Post date:** [July 6, 2020, 8:00pm UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/2 "2020-07-06T20:00:35Z")

</div>

Have you tried it on any other browser? Did it error out in the same way? Just trying to specify the problem to see if something’s up with the WriteFreely config or Chrome.

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 8, 2020, 4:21am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/3 "2020-07-08T04:21:37Z")

</div>

Yes I did. It errors out on Mozilla and safari as well. Mozilla says “Unable to connect Firefox can’t establish a connection to the server at localhost:8080.”

Safari says " Safari Canʼt Connect to the Server  
Safari canʼt open the page “​localhost:8080” because Safari canʼt connect to the server “localhost”."

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 8, 2020, 5:51am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/4 "2020-07-08T05:51:18Z")

</div>

I have also tried adjusting my proxy settings according to this SO answer [https://stackoverflow.com/a/7334546/4555196](https://stackoverflow.com/a/7334546/4555196)

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 9, 2020, 6:28am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/6 "2020-07-09T06:28:11Z")

</div>

I just tried that. same result unfortunately

---

<div class="post-metadata">

**Author:** ![matt](https://discuss.write.as/user_avatar/discuss.write.as/matt/32/2760_2.png) [@matt](https://discuss.write.as/u/matt)\
**Post date:** [July 9, 2020, 10:39am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/7 "2020-07-09T10:39:47Z")

</div>

Hi @Dami, just to be sure, are you trying to access `http://localhost:8080` from the same computer you’re running WriteFreely on?

If you’ve installed WriteFreely on a remote server and you haven’t taken extra steps like forwarding ports on your local machine, accessing `localhost` won’t work at all. Instead, you’ll need to type the server’s IP address into your browser, for example `http://192.0.0.1:8080`, where `192.0.0.1` is the server IP.

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 10, 2020, 6:34am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/8 "2020-07-10T06:34:03Z")

</div>

Thanks for the hints. I installed write freely using an ubuntu server from digital ocean. I tried using the IP address and it gives me a different error. ERR\_CONNECTION\_TIMED\_OUT. For some reason, the server is taking too long to respond even though the server is up and running.

---

<div class="post-metadata">

**Author:** ![matt](https://discuss.write.as/user_avatar/discuss.write.as/matt/32/2760_2.png) [@matt](https://discuss.write.as/u/matt)\
**Post date:** [July 10, 2020, 1:27pm UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/9 "2020-07-10T13:27:38Z")

</div>

That sounds to me like a firewall issue – access to port 8080 is probably blocked from the public internet. So for now you can allow access to this port through your firewall while you’re testing. And then whenever you’re ready to keep the site online, you can or install a reverse proxy like Nginx to make your site accessible on port 80 (normal HTTP port), instead of port 8080.

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 11, 2020, 6:13am UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/10 "2020-07-11T06:13:58Z")

</div>

The firewall for my Mac is already switched off. I don’t know why it still doesn’t work. I have used port 8080 for web servers in the past and this has never happened. I wonder what’s different.

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 11, 2020, 10:24pm UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/12 "2020-07-11T22:24:28Z")

</div>

Yes that’s correct. I tried your suggestion. This is what `sudo ufw status` outputs:

```auto
Status: active

To Action From
-- ------ ----
22/tcp ALLOW Anywhere                  
80/tcp ALLOW Anywhere                  
443/tcp ALLOW Anywhere                  
3306/tcp ALLOW Anywhere                  
8080 ALLOW Anywhere                  
22/tcp (v6) ALLOW Anywhere (v6)             
80/tcp (v6) ALLOW Anywhere (v6)             
443/tcp (v6) ALLOW Anywhere (v6)             
3306/tcp (v6) ALLOW Anywhere (v6)             
8080 (v6) ALLOW Anywhere (v6)     

```

I am now getting “This site can’t be reached. ERR\_CONNECTION\_REFUSED”. sigh.

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 15, 2020, 8:40pm UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/14 "2020-07-15T20:40:34Z")

</div>

Thanks for your support so far!

I don’t have a domain yet. I’ll try that. However, do you think changing the bind and host parameter in the config.ini to my server’s IP address instead of localhost would make a difference? I think I’ll try that as well.

Ok, I’ll change that. Thanks for heads up.

---

<div class="post-metadata">

**Author:** ![Dami](https://discuss.write.as/user_avatar/discuss.write.as/dami/32/629_2.png) [@Dami](https://discuss.write.as/u/Dami)\
**Post date:** [July 15, 2020, 9:09pm UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/15 "2020-07-15T21:09:53Z")

</div>

Ah, changing the address from localhost to my ip address fixed it 😅! I’m thinking it’s because localhost defaults to 127.0.0.1, and writefreely was serving on 127.0.0.1 and using [http://my-ip-addr:8080](http://my-ip-addr:8080) on the browser wasn’t enough since wf wasn’t serving the files on my servers IP address. Is this correct?

This is my current config file [https://gist.github.com/Obayanju/edb55aba03a7e209e69b4a66eea0b55e#file-config-ini](https://gist.github.com/Obayanju/edb55aba03a7e209e69b4a66eea0b55e#file-config-ini)

---

<div class="post-metadata">

**Author:** ![stephanieraymos](https://discuss.write.as/user_avatar/discuss.write.as/stephanieraymos/32/3403_2.png) [@stephanieraymos](https://discuss.write.as/u/stephanieraymos)\
**Post date:** [December 5, 2023, 7:23pm UTC](https://discuss.write.as/t/localhost-site-cannot-be-reached-err-connection-refused/1577/16 "2023-12-05T19:23:45Z")

</div>

Just came here to add my solution. I spent days ruling everything out from port to etc/hosts. My issue oddly was the wrong node version. Hope this helps someone.
