簡體   English   中英

Git instaweb httpd配置在OSX Leopard服務器上使用apache2

[英]Git instaweb httpd configuration to use apache2 on OSX Leopard server

默認情況下,git instaweb期待lighttpd Web服務器,而在OSX Leopard服務器上,apache2是默認服務器。

將以下內容添加到.git / config:

[instaweb]
local = true
httpd = apache2 -f
port = 4321
modulepath = /usr/libexec/apache2

並運行' git instaweb '會導致:

apache2 not found.  
Install apache2 or use --httpd to specify another httpd daemon.

我應該如何設置.git/config以使其使用我的默認Web服務器?

謝謝

原因是apache2在OS X中被命名為httpd,而模塊在其他地方。 我嘗試更改配置,使其指向正確的路徑,但服務器仍然無法正常工作。

或者,您可以使用已安裝的webrick守護程序。 將這些行添加到〜/ .gitconfig文件(全局設置)或.git / config文件(本地設置):

[instaweb]
               httpd = webrick

如果你從2009年2月開始看這個git-instaweb補丁 ,你會看到:

# check if server can be executed
httpd_only="$(echo $httpd | cut -f1 -d' ')"
if ! type $httpd_only >/dev/null 2>&1; then
  echo >&2 "$httpd_only not found. Install $httpd_only or use" \
           + "--httpd to specify another httpd daemon."
fi

你的apache2可執行屬性有問題嗎?


更新2014(5年后): 像f8ee1f0這樣的提交顯示git-instaweb不僅支持Apache,而且支持Apache 2.4:

檢測可用的Apache MPM並根據以下優先順序使用第一個:

  • mpm_event
  • mpm_prefork
  • mpm_worker

Thomas Okken回答 (upvoted)詳細介紹了如何引用https來啟動git-instaweb。

我得到git instaweb來使用我的Mac上的內置Apache(運行Lion),如下所示:

  1. 作為根:
      cd / usr / sbin;  ln -s httpd apache2 
  2. 以root 身份 :編輯/ usr / libexec / git-core / git-instaweb :添加行
      LockFile“$ fqgitdir / gitweb / $ httpd_only / access.lock”\n 用戶UsernameForYourGitServer 
    之后
      PidFile“$ fqgitdir / pid” 
  3. 最后,作為您的git用戶,cd到您的存儲庫,然后運行
      git instaweb --httpd apache2 -m / usr / libexec / apache2 

當您已經使用標准服務器時,即當您打開“Web共享”時,這甚至可以工作。 gitweb服務器將是一個單獨的進程,偵聽端口1234,而不是標准服務器使用的端口80。

要使用launchd啟動此服務器,請創建一個文件/Library/LaunchDaemons/git-web.plist ,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>GitWeb</string>
        <key>WorkingDirectory</key>
        <string>/Wherever/Your/Repository/Is</string>
        <key>ProgramArguments</key>
        <array>
            <string>git</string>
            <string>instaweb</string>
            <string>--httpd</string>
            <string>apache2</string>
            <string>-m</string>
            <string>/usr/libexec/apache2</string>
        </array>
        <key>KeepAlive</key>
        <true/>
    </dict>
    </plist>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM