Skip to content

Instantly share code, notes, and snippets.

@ksuzushima
Last active September 7, 2017 01:15
Show Gist options
  • Save ksuzushima/13b8e67e107cd8b3a8bbb5efecfafa8c to your computer and use it in GitHub Desktop.
Save ksuzushima/13b8e67e107cd8b3a8bbb5efecfafa8c to your computer and use it in GitHub Desktop.
MAMPを使った複数ホストの設定

参考: MAMPでの複数のローカルホストのたてかた!

Motivation

PreferencesからDocument Rootを毎回切り替えるのが面倒。

Setting

httpd.confの設定 (/Applications/MAMP/conf/apache/httpd.conf)

該当箇所のコメントアウトを解除

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

httpd-vhosts.confの設定 (/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf)

ポート番号をListenし、以下のように設定を書き加える。

Listen 8001

<VirtualHost *:8001>
    DocumentRoot "/Users/userId/to/document/root"
    <Directory "/Users/userId/to/document/root">
        AllowOverride All
    </Directory>
</VirtualHost>

あとはMAMPを再起動すればOK。

追記

MAMPをアップデートすると httpd.confhttpd-vhosts.conf を再設定する必要あり。バックアップファイルを参考に。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment