前段時間接觸到了代理伺服器,在摸索下搭建了nginx環境,接下來給大家介紹一下在mac上安裝nginx環境的基本步驟。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
brew install nginx
nginx -t 正确提示:nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
chmod 777 file file为需要开放权限的文件路径
vim /usr/local/etc/nginx/nginx.conf
server { listen 9999(自定义端口号); server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /Users/loki/Desktop/web/(需要部署应用的文件路径); index index.html index.htm; }
sudo nginx