タグ: hosts

Macのhostsファイル

自宅サーバに自宅内からアクセスするとき、外からのアクセスと同じようにドメイン名でアクセスしたい。
てなわけで、Windowsとかと同じようにhostsを書き換える。
hostsは[ /etc ]配下にあるので

sudo vi /etc/hosts

192.168.1.2   katzplus.com
192.168.1.2   storage.katzplus.com

あたりを追加して保存。

Apache起動時のメッセージ

[root@localhost /]# /etc/rc.d/init.d/httpd start
httpd を起動中: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
                                                           [  OK  ]

こんなカンジで出てくるのが邪魔。
なのでこれを消すために /etc/hosts に、httpd.confに設定しているServerNameを書き足す。
ServerNameは275行目あたりに書いてある。

192.168.1.2 katzplus.com

これで再起動しても出ない?

もう一つできることがあるっぽいのでそれもやっておく。

vi /etc/hosts

で、

127.0.0.1               localhost localhost.localdomain

127.0.0.1               localhost.localdomain localhost

に変更する。

[root@localhost /]# /etc/rc.d/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]