1. 打開終端,開啟Apache:
//開啟apache: sudo apachectl start
//重啟apache: sudo apachectl restart
//關閉apache: sudo apachectl stop
回車會提示輸入密碼,也就是你電腦的密碼,http://127.0.0.1/測試一下,成功則如下圖:
2. 點擊Finder,然后Command+Shift+G,前往如下路徑(mac下Apache服務器的文件路徑)
/Library/WebServer/Documents
在步驟1中只輸入一個http://127.0.0.1其實默認打開的是index.html.en(html是一個網頁文件),該文件的內容就是在步驟1中測試時瀏覽器所顯示的內容.
此時如果我在瀏覽器的網址框輸入的是http://127.0.0.1/PoweredByMacOSX.gif, 瀏覽器就便會顯示PoweredByMacOSXLarge.gif圖片.
3. 使用過后,記得關閉服務器,要不然會一直消耗你電腦內存,后果你懂的。