0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

localhost以外の名前でもlocalhost(127.0.0.1)にアクセスできるようにする

Last updated at Posted at 2022-07-12

localhost以外の名前でも127.0.0.1にアクセスできるようにする方法
macOSでの設定方法です。

sudo vi /etc/hosts

管理者権限で/etc/hostsのファイルを開いて情報を追加します。

開くとこんな中身↓

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

127.0.0.1 localhostとあるので同じように
127.0.0.1 api.localhost.localといった感じで使いたいアドレスを追加すればOKです。

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
127.0.0.1 api.localhost.local //追加
255.255.255.255 broadcasthost
::1             localhost

M1Macに買い替えて久々に環境設定したので忘れていました。。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?