Debian の /etc/hosts は再起動時に自動的にリセットされます。

Debian の /etc/hosts は再起動時に自動的にリセットされます。

vpsプロバイダがサーバーを再起動することを決定したとき(Debian 5.0.8を実行)、サーバーがペアを思い出せない問題に直面しました/etc/hosts。必要なのは、サーバー上のWebアプリケーションのデータベースエイリアスです。を指す127.0.0.1localhost)。

私はそれが次のように見えるようにしたいです:

# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


127.0.0.1 localhost.localdomain localhost webservice database
# Auto-generated hostname. Please do not remove this comment.
XXX.XX.XXX.XX xxxxxx.net.au  xxxxxx www.xxxxxxx.net.au xxxxxxx

ただし、再起動するたびに、次のようにリセットされます。

# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


127.0.0.1 localhost.localdomain localhost webservice
# Auto-generated hostname. Please do not remove this comment.
XXX.XX.XXX.XX xxxxxx.net.au  xxxxxx www.xxxxxxx.net.au xxxxxxx

データベースが存在しない場合、これを行うにはファイルを手動で変更する必要があります。この問題はしばらく発生して面倒になりましたが、変更を維持する方法が見つからないようです。何をすべきかを知っている人はいますか?

ベストアンサー1

#Auto-generate ホスト名の行を削除して変更すると、ホスト名を生成するすべてのエントリが記憶されます。私には効果がありますが、誰にも効果がない可能性があります。

おすすめ記事