Tôi có một máy chủ dựa trên Java (tệp jar) và nó đang chạy trên cổng 8080.
Nó đang chạy tốt trên tôi localhost, nhưng tôi không thể truy cập nó qua các mạng khác
Tôi nghĩ đó là một vấn đề tường lửa. Vì vậy, trước tiên, tôi đã thử socketfilterfw:
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp
hellomac# sudo /usr/libexec/ApplicationFirewall/socketfilterfw --list
ALF: total number of apps = 5
1 : /usr/bin/nc
( Allow incoming connections )
2 : /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java
( Allow incoming connections )
Nó không giúp được gì. Thứ hai, thêm quy tắc trong pf.
hellomac# cat /etc/pf.conf
#
# Default PF configuration file.
#
# This file contains the main ruleset, which gets automatically loaded
# at startup. PF will not be automatically enabled, however. Instead,
# each component which utilizes PF is responsible for enabling and disabling
# PF via -E and -X as documented in pfctl(8). That will ensure that PF
# is disabled only when the last enable reference is released.
#
# Care must be taken to ensure that the main ruleset does not get flushed,
# as the nested anchors rely on the anchor point defined here. In addition,
# to the anchors loaded by this file, some system services would dynamically
# insert anchors into the main ruleset. These anchors will be added only when
# the system service is used and would removed on termination of the service.
#
# See pf.conf(5) for syntax.
#
#
# com.apple anchor point
#
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
pass in proto tcp from any to any port 8080
Nhưng nó cũng không giúp được gì.
Vì vậy những gì là sai? Tôi nên làm gì bây giờ?
