nginx 配置使用

mac环境下安装配置nginx ,使用homebrew来安装各个软件既快捷又不用考虑依赖包的问题。
1、 先安装 homebrew
2、安装Nginx,终端下执行

brew install nginx

3、启动nginx服务

brew services start nginx 

终端显示

pingdeMac-mini:~ mirror$ brew services start nginx
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 14 (delta 0), reused 10 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), done.
Checking connectivity... done.
Tapped 0 formulae (42 files, 55.0KB)
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)

成功后,使用浏览器打开http://localhost:8080

4、中断服务器

nginx -s quit

5、nginx 文件目录

 nginx安装文件目录
/usr/local/Cellar/nginx
  nginx配置文件目录
/usr/local/etc/nginx
  config文件目录
/usr/local/etc/nginx/nginx.conf
  系统hosts位置
/private/etc/hosts

你可能感兴趣的:(nginx 配置使用)