Not able to run web service on linux on specific ports

Abdul Asjad Naaz 0 Reputation points
2023-06-19T16:06:41.7366667+00:00

I have created linux VM on azure portal. It 's version is Centos 8.0 and I am tryign runnign docker on top of that. I ahve cretaed web apllication using Julia Genie prog language. When I deployed web servcie its not allowing access to ports. I ahve already created inbound and outbound rules for port under azure NSG and added same in port in linux firewall. But still its not working. It's throwing below error . I already validated port has no issue and no application running on the port.

Info:
└ Web Server starting at http://<my-ip>:8010 - press Ctrl/Cmd+C to stop the server.
ERROR: LoadError: cannot bind to port; may already be in use or access denied
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] #listen#10
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Sockets/src/Sockets.jl:624 [inlined]
 [3] HTTP.Servers.Listener(addr::Sockets.InetAddr{Sockets.IPv4}, host::String, port::String; sslconfig::Nothing, reuseaddr::Bool, backlog::Int64, server::Nothing, listenany::Bool, kw::Base.Iterators.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol}, NamedTuple{(:verbose, :rate_limit), Tuple{Bool, Nothing}}})
   @ HTTP.Servers ~/.julia/packages/HTTP/uAaAw/src/Servers.jl:69
 [4] #Listener#3
   @ ~/.julia/packages/HTTP/uAaAw/src/Servers.jl:74 [inlined]
 [5] #listen#6
   @ ~/.julia/packages/HTTP/uAaAw/src/Servers.jl:312 [inlined]
 [6] (::Genie.Server.var"#6#13"{Bool, Nothing, Nothing, Bool, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}})()
   @ Genie.Server ~/.julia/packages/Genie/XpFvB/src/Server.jl:113
 [7] up(port::Int64, host::String; ws_port::Nothing, async::Bool, verbose::Bool, ratelimit::Nothing, server::Nothing, wsserver::Nothing, open_browser::Bool, reuseaddr::Bool, updateconfig::Bool, http_kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Genie.Server ~/.julia/packages/Genie/XpFvB/src/Server.jl:137
 [8] #up#17
   @ ~/.julia/packages/Genie/XpFvB/src/Server.jl:157 [inlined]
 [9] top-level scope
   @ /app/routes.jl:5
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,021 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Manu Philip 20,206 Reputation points MVP Volunteer Moderator
    2023-06-19T17:04:33.2733333+00:00

    Have you tried to see if firewall in CentOS is blocking the ports?

    Check the running status of firewall: sudo firewall –cmd --state

    Temporarily stop the firewall: sudo systemctl stop firewalld

    Check again and see the port access is working after stopping the firewall. If the issue due to the firewall, you may need to disable or filter the required ports in firewall


    --please don't forget to upvote and Accept as answer if the reply is helpful--


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.