配置 dnsmasq 以在 Mac OS X Mountain Lion 上正確使用 mod_rewrite

配置 dnsmasq 以在 Mac OS X Mountain Lion 上正確使用 mod_rewrite

我迫切需要幫助。

我在 echoditto 部落格上讀到一篇文章(http://www.echoditto.com/blog/never-touch-your-local-etchosts-file-os-x-again)並遵循使用自製軟體在我的 Mac 上設定 dnsmasq 的建議。現在我遇到了一個無法解決的問題,我需要幫助,因為它完全破壞了我的開發工作。

最初,在實作 dnsmaqs 後,我根本無法載入我的網站…但我能夠透過將 httpd-vhosts.conf 檔案的內容更改為以下內容來解決該問題:

#allow access to the Hosts directory where your sites are
<Directory "/Volumes/sites">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    #you could configure the following to only allow access from localhost
    Order allow,deny
    Allow from all
</Directory>

#get the server name from the Host: header
UseCanonicalName Off
VirtualDocumentRoot /Volumes/sites/%0/

現在,我可以將瀏覽器指向http://網域.dev/並讓網站加載。

但是,使用 Joomla 時,我遇到了 mod_rewrite 問題:

我可以透過瀏覽到毫無問題地載入管理員後端http://網域.dev/administrator/

我可以透過瀏覽到加載網站的主頁,沒有任何問題http://網域.dev/

但是,如果我單擊通常會加載子頁面的任何鏈接,例如http://網域.dev/about我收到 404 錯誤或 500 錯誤以及以下頁面內容:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

我嘗試切換回非動態虛擬主機,但它不再起作用了。

我也無法透過將瀏覽器指向來存取這些網站http://localhost/domainname.dev

請盡快提供建議,否則我將不得不完全重新安裝我的 Mac,而且我無法承受停機時間。

我已將 httpd.conf 檔案、httpd-vhosts.conf 檔案和範例 .htaccess 檔案上傳到重點:https://gist.github.com/alisamii/6549754

另外,可能值得注意的是,我嘗試恢復到安裝 dnsmasq 之前的設置,以便我可以使用 URL 方案訪問本地站點,http://localhost/path/to/site但它不再起作用,並且出現伺服器配置錯誤。

相關內容