私のWebサーバーが受信するホストアドレスをどのように変更しますか?

私のWebサーバーが受信するホストアドレスをどのように変更しますか?

私はUbuntuホストにWebサーバーを設定しています。具体的にはgdbgui。ヘルプ情報によれば、これを使用してリッスンし--hostているホストIPを指定できます。私のホストには次のIP設定があります。

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:9f:02:c9:97  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp89s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 1c:69:7a:a5:c2:e0  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0x6a200000-6a2fffff

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 163716  bytes 56247108 (56.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 163716  bytes 56247108 (56.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlo1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet **192.168.50.69**  netmask 255.255.255.0  broadcast 192.168.50.255 <========= HERE
        inet6 fe80::3fd:752e:5ded:467f  prefixlen 64  scopeid 0x20<link>
        ether 70:9c:d1:21:c5:f0  txqueuelen 1000  (Ethernet)
        RX packets 270277  bytes 117510355 (117.5 MB)
        RX errors 0  dropped 15  overruns 0  frame 0
        TX packets 93011  bytes 45155962 (45.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

同じLAN上の他のコンピュータがアクセスできるように192.168.50.69を使用したいと思います。

しかし、常に127.0.0.1を受け取ります。明示的に--host指定しても同じですgdbgui

gdbgui --host 192.168.50.69 ...

どのように変更できますか?この質問はgdbguiに限定されていないようです。

ありがとうございます!

ベストアンサー1

gdbguiの問題を修正しました。

このオプションには、ホストIPの代わりにホスト名を指定する必要があります--host。このように:

gdbgui --host myBox ...

/etc/hosts次に、ホスト名のIPアドレスを指定するようにファイルを変更する必要があります。このように:

192.168.50.69   myBox

おすすめ記事