Last article we talked about some of the entry-function use nginx, but nginx under Mac book on how to configure it? This will be the focus of this article;
Install nginx
-
Open Terminal Terminal
-
Installation brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
复制代码
3. Install nginx
brew install nginx
- Check whether the installation was successful
nginx -v
复制代码
Output version
nginx version: nginx/1.15.6 //我的是这个
复制代码
As the output of the installation is successful default download path 5. nginx
/usr/local/etc/nginx/nginx.conf (profile path) / usr / local / var / www (the default server path) /usr/local/Cellar/nginx/1.12.0 (installation path)
Modify the configuration file is recommended to use vim
brew install vim // 安装
复制代码
Use vim turn novice tutorial vim / vi
- Start nginx
// 在终端输入
nginx // 启动
// 如果报无权限 则加上管理权限启动
sudo nginx
复制代码
After starting a successful visit localhost:! 8080 if the page output Welcome to nginx is a successful start
- nginx common commands
nginx -s quit // 退出
nginx -s reload // 重新加载
nginx -t //测试nginx.conf配置
复制代码
Nginx configuration can be viewed on a quiet Eno | nginx configuration / deployment / Agent
Finally, if article helpful to you, do not forget to point praise Oh, easy creation, please indicate the source article switched quiet Eno @ Mac configuration nginx