Kaie"s Blog 2.0 beta!
Back to "Top"

My Secret Notebook
 Show "Table of Contents"
Contact Me
Subscribe to my Posts feed
Subscribe to my Comments feed
My Flickr
Back to "Top"
My Secret Notebook
 Show "Table of Contents"
Contact Me
Subscribe to my Posts feed
Subscribe to my Comments feed
My Flickr

Sunday, March 08, 2009

[Mac] Apache web sharing bug - 為何"網頁共享"會失效

   這幾天心血來潮,想說將我的Max OS X的Apache (Http server - httpd)跑起來玩看看,畢竟在Mac OS X很多事只要簡單的設定一下就OK了,如下:
但這次踢到鐵板了,在連到最上層的網頁根目錄 (http://localhost/) 是OK的,代表apache有成功run起來,但在針對個人帳戶這邊,也就是 http://localhost/~username/,怎麼連就是會出現 403 Forbidden.
You don't have permission to access /~username/ on this server.
真是見鬼了,只好求助於Google大神,後來發現,若啟動了"網頁共享"服務的話,在針對個人用戶方面,Mac OS X應該在此目錄下/private/etc/apache2/users/新增一個和你的username相關的username.conf設定檔,但卻發現此檔案卻不存在於此,因此請自行新增一個吧,內容如下:<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
之後記得重新啟動apache使生效sudo apachectl restart