局域網(wǎng)搭建 Web 服務器測試環(huán)境,因為Mac OS X 自帶了 Apache 和 PHP 環(huán)境赊淑,我們只需要簡單的啟動它就行了爵政。驚不驚喜,意不意外!??
1.相關(guān)命令
a.啟動 Apache 命令 : sudo apachectl start
b.停止 Apache 命令 : sudo apachectl stop
c.重啟 Apache 命令 : sudo apachectl restart
2.Apache相關(guān)信息
a.Apache服務器默認的web根目錄在:/Library/WebServer/Documents
b.Apache的配置文件在:/etc/apache2
3.預覽內(nèi)容,請再瀏覽器輸入以下兩個任意地址:
a. http://localhost/
b. http://127.0.0.1/
image.png
4.如何查看自己編寫的文件
將自己編寫的html文件復制到 /Library/WebServer/Documents
文件夾下,無需重啟服務,及時瀏覽內(nèi)容.
路徑.png
瀏覽器訪問 index.html
文件,瀏覽方式有三種:
http://localhost/index.html
2.http://127.0.0.1/index.html
3.本機ip/index.html
預覽.png