在Mac系統(tǒng)下配置Nginx服務器
- 搜索
brew search nginx
- 安裝
brew install nginx
image.png
安裝成功
- 啟動nginx服務器
sudo nginx
- 訪問
nginx默認頁面
image.png
瀏覽器訪問成功痹栖。
常用命令
- 查看版本温峭,以及配置文件地址
nginx -V
- 查看版本
nginx -v
- 指定配置文件
nginx -c filename
- 幫助
nginx -h
- 重新加載配置|重啟|停止|退出 nginx
nginx -s reload|reopen|stop|quit
-打開 nginx
sudo nginx
- 測試配置是否有語法錯誤
nginx -t
文件說明
/usr/local/etc/nginx/nginx.conf (配置文件路徑)
/usr/local/var/www (服務器默認路徑)
/usr/local/Cellar/nginx/1.8.0 (安裝路徑
修改nginx默認端口號
cd /usr/local/etc/nginx/nginx.conf
image.png
image.png
修改以上兩處