当前位置:   article > 正文

Mac 之 Nginx 安装_mac查看nginx安装目录

mac查看nginx安装目录

Mac 之 Nginx 安装

参考

打开终端, 对 brew 进行更新

brew update
  • 1

查询 Nginx 是否存在

brew search nginx
  • 1

查看 Nginx 详情

brew info nginx
  • 1

正式开始安装

brew install nginx
  • 1

查看 Nginx 安装目录(是否如 info 所说)

open /usr/local/etc/nginx/ # 配置目录
open /usr/local/Cellar/nginx # 安装目录
  • 1
  • 2

启动 Nginx, 终端输入如下命令

nginx
  • 1

修改 Nginx 配置

vim /usr/local/etc/nginx/nginx.conf
  • 1

http 里面增加

# 开启目录文件列表
autoindex on;
# 显示出文件的确切大小, 单位是bytes
autoindex_exact_size off;
# 显示的文件时间为文件的服务器时间
autoindex_localtime on;
#设置字符集
charset utf-8,gbk;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

添加 server 配置

server {
    ...
    location / {
        root   /Users/zhangsan/projects/;
        index index.php index.html index.htm;
    }

    location ~ \.php$ {
        root           /Users/zhangsan/projects/;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
    ...
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号