美文网首页
Mac 安装NginX

Mac 安装NginX

作者: ChasenGao | 来源:发表于2018-09-14 13:26 被阅读13次

    1、卸载原有home brew(如果不存在直接进行第二步)

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    
    

    2、安装最新版本homebrew

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
    

    3、根据信息配置conf文件(无特殊需求默认即可)

    Docroot is: /usr/local/var/www
    
    The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
    nginx can run without sudo.
    
    nginx will load all files in /usr/local/etc/nginx/servers/.
    
    To have launchd start nginx now and restart at login:
      brew services start nginx
    Or, if you don't want/need a background service you can just run:
      nginx
    
    

    4、将网站目录放到www中

    5、运行

    sudo nginx -c /usr/local/etc/nginx/nginx.conf
    sudo nginx -s reload
    

    6、如果端口被占用,可先杀死进程,再进行第五步。

    ps -ef | grep nginx
    

    相关文章

      网友评论

          本文标题:Mac 安装NginX

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