&tag(Homebrew/apache);
*目次 [#k3bbf3df]
#contents
*参考情報 [#v5a49fd8]
-[[Homebrew]]

*インストール [#yb2943dd]
-tapが必要
#pre{{
$ brew tap homebrew/dupes
$ brew install httpd
}}
-次のようなインストラクションが表示される
#pre{{
You should reload httpd:
    launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
}}
*設定ファイルなど [#s415330a]
-/usr/local/etc/apache2/httpd.conf を編集する。
*起動 [#t209dc83]
-デフォルト設定のポート80で動かす場合root権限が必要。この場合rootで起動するために/Library/LaunchAgentsにplistのシンボリックリンクを貼る
 sudo cd /Library/LaunchAgents
 sudo ln -s /Library/LaunchAgents/homebrew.mxcl.httpd.plist
 sudo chown root:wheel homebrew.mxcl.httpd.plist
 sudo launchctl load -w /Library/LaunchAgents/homebrew.mxcl.httpd.plist

-一般ユーザーで動かす場合
 launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
*未確認情報[#i738145d]
**brew servicesって何? [#icb13c46]
-以下のコマンドを実行すると/Library/LaunchDaemonsにplistが作られる。
 sudo brew services start httpd
-/Library/LaunchAgents/homebrew.mxcl.httpd.plistが作られる。これを使えばroot起動が簡単?
 sudo launchctl load  -w /Library/LaunchAgents/homebrew.mxcl.httpd.plist

**run、logディレクトリが作られない? [#k662a466]
※[[httpd log and run directories not being created · Issue #119 · Homebrew/homebrew-dupes · GitHub:https://github.com/Homebrew/homebrew-dupes/issues/119]]に、run、logディレクトリが作られず起動できないエラーが報告されている。手動でディレクトリを作らないとだめかも(と思ったけど、rootで起動すれば大丈夫かも。場所は/usr/local/var/apache2/log)。

*トラブルシューティング [#laa2340b]
**ユーザーディレクトリにアクセスできない。 [#nd11dfc3]
-extra/httpd-userdir.confがまちがっていないか確認する。
-初期状態だと、UserDir public_html、Directory /home/*/public_htmlになっていた。当然こんなフォルダMacには存在しないのでエラーになる。MacPortsと同じにしたい場合次のように、UserDirとDirectoryを療法変更する。
#pre{{
UserDir Sites

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory "/Users/*/Sites">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>
}}

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS