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
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容