Mac Nginx安装

来源:互联网 发布:写作软件 编辑:程序博客网 时间:2024/05/19 08:22

Mac Nginx安装

$brew search nginx
-bash: brew: command not found
$curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1



x share/man/
x share/man/man1/
x share/man/man1/brew.1
$        
nginx
homebrew/nginx/accept-language-nginx-module          homebrew/nginx/lua-nginx-module
homebrew/nginx/accesskey-nginx-module              homebrew/nginx/mod-zip-nginx-module
homebrew/nginx/ajp-nginx-module                  homebrew/nginx/mogilefs-nginx-module
homebrew/nginx/anti-ddos-nginx-module              homebrew/nginx/mp4-h264-nginx-module
homebrew/nginx/array-var-nginx-module              homebrew/nginx/nginx-full
homebrew/nginx/auth-digest-nginx-module              homebrew/nginx/notice-nginx-module
homebrew/nginx/auth-ldap-nginx-module              homebrew/nginx/php-session-nginx-module
homebrew/nginx/auth-pam-nginx-module              homebrew/nginx/push-stream-nginx-module
homebrew/nginx/auto-keepalive-nginx-module          homebrew/nginx/realtime-req-nginx-module
homebrew/nginx/autols-nginx-module              homebrew/nginx/redis-nginx-module
homebrew/nginx/cache-purge-nginx-module              homebrew/nginx/redis2-nginx-module
homebrew/nginx/captcha-nginx-module              homebrew/nginx/rtmp-nginx-module
homebrew/nginx/consistent-hash-nginx-module          homebrew/nginx/set-misc-nginx-module
homebrew/nginx/counter-zone-nginx-module          homebrew/nginx/small-light-nginx-module
homebrew/nginx/ctpp2-nginx-module              homebrew/nginx/subs-filter-nginx-module
homebrew/nginx/dav-ext-nginx-module              homebrew/nginx/tcp-proxy-nginx-module
homebrew/nginx/dosdetector-nginx-module              homebrew/nginx/txid-nginx-module
homebrew/nginx/echo-nginx-module              homebrew/nginx/unzip-nginx-module
homebrew/nginx/eval-nginx-module              homebrew/nginx/upload-nginx-module
homebrew/nginx/extended-status-nginx-module          homebrew/nginx/upload-progress-nginx-module

homebrew/nginx/fancyindex-nginx-module              homebrew/nginx/upstream-hash-nginx-module
homebrew/nginx/headers-more-nginx-module          homebrew/nginx/upstream-order-nginx-module
homebrew/nginx/healthcheck-nginx-module              homebrew/nginx/ustats-nginx-module
homebrew/nginx/http-flood-detector-nginx-module          homebrew/nginx/var-req-speed-nginx-module
homebrew/nginx/http-remote-passwd-nginx-module          homebrew/nginx/websockify-nginx-module
homebrew/nginx/log-if-nginx-module              homebrew/nginx/xsltproc-nginx-module
$sudo brew uninstall nginx
Error: No such file or directory - /usr/local/Cellar
$sudo brew uninstall pcre
Error: No such file or directory - /usr/local/Cellar
$sudo brew install nginx
==> Installing dependencies for nginx: pcre, openssl
==> Installing nginx dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.37.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pcre-8.37.yosemite.bottle.tar.gz
��  /usr/local/Cellar/pcre/8.37: 146 files, 5.9M
==> Installing nginx dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
��  /usr/local/Cellar/openssl/1.0.2d_1: 464 files, 18M
==> Installing nginx
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.8.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring nginx-1.8.0.yosemite.bottle.1.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 at login:
  ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
Then to load nginx now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Or, if you don't want/need launchctl, you can just run:
  nginx
==> Summary
��  /usr/local/Cellar/nginx/1.8.0: 7 files, 964K
$cd /usr/local/Cellar/nginx/1.8.0/
$ls
CHANGES                README                html
INSTALL_RECEIPT.json        bin                share
LICENSE                homebrew.mxcl.nginx.plist
$whereis nginx
$nginx -V
nginx version: nginx/1.8.0
built by clang 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
built with OpenSSL 1.0.2d 9 Jul 2015
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/1.8.0 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx/1.8.0/bin/nginx --with-cc-opt='-I/usr/local/Cellar/pcre/8.37/include -I/usr/local/Cellar/openssl/1.0.2d_1/include' --with-ld-opt='-L/usr/local/Cellar/pcre/8.37/lib -L/usr/local/Cellar/openssl/1.0.2d_1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-http_gzip_static_module
$nginx
nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
2015/09/07 16:24:06 [emerg] 61000#0: mkdir() "/usr/local/var/run/nginx/client_body_temp" failed (13: Permission denied)
$sudo nginx
$ps -ef|grep nginx
    0 61003     1   0  4:24下午 ??         0:00.00 nginx: master process nginx
   -2 61004 61003   0  4:24下午 ??         0:00.00 nginx: worker process
  501 61008 14314   0  4:24下午 ttys002    0:00.00 grep nginx
$sudo vim /usr/local/etc/nginx/nginx.conf
Password:
$sudo nginx -s reload

备注:ln -s  /usr/local/sbin/nginx /usr/bin/nginx 做了个软连接。

常用的指令有:

nginx -V 查看版本,以及配置文件地址

nginx -v 查看版本

nginx -c filename 指定配置文件

nginx -h 帮助

nginx -s [reload\reopen\stop\quit]



brewhome 常用的指令:

brew search mysql : 搜索具体的程序包

brew install mysql : 安装具体的程序包

brew info mysql : 查看具体程序的信息

brew uninstall mysql : 卸载具体的应用(这里只是用mysql  作个例子)

0 0