1

I have deployed my spring boot app jar to centos server with this command:

nohup java -jar black-0.0.1-SNAPSHOT.jar > log_black.out & 

In my application.properties I set the server port like this:

server.port=8181

Here is my IP table:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination
  128 10070 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:8181
1007M   69G ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:443
  17M 1155M ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80

Now I can access to this port with local IP address (10.1.90.45:8181). But I can't access to it via public IP address. What should I do?

1

Assuming the public IP address is available on the machine hosting the service, the issue is likely one of configuration, you mention the server.port option, what is server.address configured to? It should probably be 0.0.0.0.

I should also mention, your firewall there isn't doing much firewalling, you should change your INPUT chain policy to DROP, that way it will drop packets not specifically allowed, also add a rule allowing ICMP packets.

2
  • Ohh server.address was not configured. But when I configured it to public IP of my server, it throws BindException: Cannot assign requested address.
    – Zolbayar
    Jul 8 '15 at 2:33
  • Use netstat -lpn to find out if something is using that address, and what. Also make sure the address is available on the system (ie you can see it on an interface in ifconfig)
    – Aaron Tate
    Jul 9 '15 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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