美文网首页环境搭建
nginx - mac - 安装

nginx - mac - 安装

作者: IntoTheVoid | 来源:发表于2020-03-26 15:03 被阅读0次

转载自:https://segmentfault.com/a/1190000016020328

必备工具
homebrew https://brew.sh/index_zh-cn.html (安装方法自行搜索)

安装完毕后打开命令行

步骤一:先更新homebrew

brew update

如果上面操作长时间没任何动静,请更换镜像,参考清华的镜像 https://mirrors.tuna.tsinghua...

步骤二: 查看nginx信息

brew search nginx
image.png

步骤三:安装nginx

brew install nginx
image.png

安装完毕
主页的文件在/usr/local/var/www 文件夹下
对应的配置文件地址在/usr/local/etc/nginx/nginx.conf

[图片上传失败...(image-668a9f-1585206006215)]

步骤四:运行nginx

nginx

nginx默认使用8080端口 如果发现端口被占用了,可以杀掉使用使用改端口的进程,也可以修改/usr/local/etc/nginx/nginx.conf 下的

http {
    server {
        listen       8181;
        server_name  localhost;  

        #charset koi8-r;
        .....
        }
    }

重新启动nginx

nginx -s reload
image.png

相关文章

网友评论

    本文标题:nginx - mac - 安装

    本文链接:https://www.haomeiwen.com/subject/ofdcuhtx.html