I am currently trying to get NGINX accessable over the internet. I have installed NGINX on my raspi 3, configured and got it up and running on port 81.

I am using the default config for NGINX. I have just changed the port number.

If I use the local ipv4 or ipv6 address on my computer to access the website, everything works fine. But if I try to access the site over my public IP-Address Chrome throws me the error "Connection refused".

I have forwarded the port 81 on my fritz.box to the raspi, but it doesn't work. To check if the port forwarding works, I have installed an apache server on my main computer and forwarded everything to port 82, which worked. I can access the website hosted on my computer, but not the website hosted on the pi.

I have checked the iptables if something got blocked and flushed them, but still no success.

I have tried to analyze my network traffic through Wireshark but got no results that could help me. Furthermore I have tried to analyze the traffic over my fritz.box via the traffic monitor, but still no results..

I hope someone can give me some hints at what I can look at to investigate more.


  • We can not be sure if you got all the steps right, so check again. Have you bind the mac address of the raspberry to the local ip you want it to use? Have you tested the sites using a system outside your network (use your mobile's data to test the pages)? Does your rooter or the network provider have a firewall that maybe blocking the traffic?
    – GramThanos
    Commented Mar 1, 2019 at 15:20
  • 1) MAC-address is correctly bound to the ip. 2) Yes, tried via mobile phone (no WiFi) 3) It worked with my local apache server, so I think that there is no issue with my provider or router firewall. Thanks for your fast reply
    – Slenti
    Commented Mar 1, 2019 at 15:28
  • You can check if there is the problem is not cause from the raspberry by temporary setting router's port 81 to forward to your pc's port 82 and testing if you pc responds on the <public-ip>:81 . It the request fail, the problem is not caused by the raspberry.
    – GramThanos
    Commented Mar 1, 2019 at 16:06
  • Also check this serverfault question nginx not serving requests to external IP address
    – GramThanos
    Commented Mar 1, 2019 at 16:12
  • What does it mean "Connection refused"? What refused the connection? The fritz.box? The NGINX server? Do you try to access a https page on port 81? What is the name of your site? I would like to connect to it.
    – Ingo
    Commented Mar 1, 2019 at 18:43

1 Answer 1


After digging deeper I have found the error.

My provider provides only DS lite, this means that I got no IPv4 for my own, so port forwarding does not work and I have to use IPv6. After configuring the nginx config to use IPv6 everything works fine. The only problem/flaw is that many devices, like smartphones, do not support yet IPv6. This is why I got the errors on my smartphone.

So, now I have to options:

1) Wait until everyone uses IPv6 (e.g. mobile devices)

2) Use a port mapper or something like that, so that I can map/tunnel with IPv4.

Thanks for your fast replies and help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.