美文网首页
brew安装nginx

brew安装nginx

作者: sprainkle | 来源:发表于2018-09-03 11:23 被阅读19次

    安装nginx

    brew install nginx
    ==> Installing dependencies for nginx: pcre
    ==> Installing nginx dependency: pcre
    ==> Downloading https://homebrew.bintray.com/bottles/pcre-8.42.high_sierra.bottle.tar.gz
    ######################################################################## 100.0%
    ==> Pouring pcre-8.42.high_sierra.bottle.tar.gz
    🍺  /usr/local/Cellar/pcre/8.42: 204 files, 5.3MB
    ==> Installing nginx
    ==> Downloading https://homebrew.bintray.com/bottles/nginx-1.15.2.high_sierra.bottle.tar.gz
    ######################################################################## 100.0%
    ==> Pouring nginx-1.15.2.high_sierra.bottle.tar.gz
    ==> Caveats
    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
    ==> Summary
    🍺  /usr/local/Cellar/nginx/1.15.2: 23 files, 1.4MB
    ==> Caveats
    ==> nginx
    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
    

    启动nginx服务

    brew services start nginx
    ==> Tapping homebrew/services
    Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
    remote: Counting objects: 14, done.
    remote: Compressing objects: 100% (10/10), done.
    remote: Total 14 (delta 0), reused 7 (delta 0), pack-reused 0
    Unpacking objects: 100% (14/14), done.
    Tapped 1 command (43 files, 55.2KB).
    ==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
    

    最后访问: http://localhost:8080/
    若看到 Welcome to nginx!即代表安装并启动成功。

    nginx文件目录

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

    nginx常用命令

    nginx  #启动nginx
    nginx -s quit  #快速停止nginx
    nginx -V #查看版本,以及配置文件地址
    nginx -v #查看版本
    nginx -s reload|reopen|stop|quit   #重新加载配置|重启|快速停止|安全关闭nginx
    nginx -h #帮助
    

    卸载nginx

    brew uninstall nginx
    

    相关文章

      网友评论

          本文标题:brew安装nginx

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