How to make an ipfs daemon into a public gateway?

I am accessing ipfs from an Azure server. In order to view it on my web browser, I changed the API and the Gateway access from to using the commands:
ipfs config Addresses.API /ip4/
ipfs config Addresses.Gateway /ip4/

The command ipfs daemon gives the following logs:

Initializing daemon…
Successfully raised file descriptor limit to 2048.
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit/ipfs/QmZtmKSApr3v9pxY95dd25kq5BRMF5saLtRwTBTuazhpjU
Swarm announcing /ip4/
Swarm announcing /ip4/
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/
Gateway (readonly) server listening on /ip4/
Daemon is ready

Yet the url http://my_ip_address:5001/webui gives “site cannot be reached”. What should I do?

Did you open the relevant ports to your Azure VM?

Note that you only need the gateway port opened to run a gateway. I think exposing the API port is not recommended.

Yeah, the relevant ports are opened

What do you get if you run telnet 8080 from a remote machine?

Assuming the Azure-specific setup is correct, maybe there’s a local firewall blocking those ports.

Trying my_ip_address_here…
telnet: Unable to connect to remote host: Connection timed out

There’s something discarding connection attempts to your gateway port, then.

How are you applying the Azure network security group with port 8080 open to your VM? Are you applying it to the subnet that the VM is on or did you apply it to a virtual interface?

What does the output from iptables -L -n show on your VM? That should give us an idea of whether the VM’s firewall is blocking the connection.

Maybe you can try change the Addresses.API and Addresses.Gateway directly to your IP address.
I was using a LAN network, at first the two addresses are both set to It works for http://localhost:8080/ipfs/[hash], but http://[ip address]:8080/ipfs/[hash] dosen’t work.
I changed the config file to :
“API”: “/ip4/[ip address]/tcp/5001”,
“Gateway”: “/ip4/[ip address]/tcp/8080”
and it works.

Hope this can do some help for your problem

Based on the earlier output the gateway is already listening on all interfaces (

You have to use the public IP of the server

Why? should listen on all interfaces.