OSX 系统安装Nginx

导读:本篇文章讲解 OSX 系统安装Nginx,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

使用brew命令安装

#brew install nginx

安装完成后,部分提示信息如下所示:

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
amazon-ecs-cli      erlang              kubernetes-helm     phpmd
angular-cli         ethereum            kustomize           prometheus
ansible             exploitdb           languagetool        proteinortho
apache-flink        ffmpeg              lgogdownloader      protoc-gen-go
ask-cli             firebase-cli        libhdhomerun        pyenv
atomist-cli         fonttools           libjson-rpc-cpp     pyside
aws-sdk-cpp         frugal              libraw              python
babel               fs-uae              libsbol             r
balena-cli          gatsby-cli          libvirt             redex
bazel               ghostscript         linkerd             s3-backer
binaryen            ginac               lmod                s3ql
bitrise             glib                log4cplus           serverless
botan               glide               log4shib            shibboleth-sp
bro                 glooctl             logcheck            ship
caddy               goreleaser          logstash            sip
cfn-lint            gradle              mednafen            swagger-codegen
chakra              gsoap               mesa                swagger-codegen@2
chipmunk            hcloud              meson               syncthing
chronograf          helmfile            minio               sysdig
citus               hub                 minio-mc            tag
ckan                hwloc               mkl-dnn             telegraf
cocoapods           hypre               monit               terraform
conan               igv                 mono                tomcat
contentful-cli      imagemagick         nim                 tomcat@8
convox              isync               node                u-boot-tools
cxxopts             janet               nsd                 ucloud
dcd                 jetty               ocrmypdf            vim@7.4
debianutils         jfrog-cli-go        opam                webdis
digdag              jhead               open-zwave          xml-tooling-c
dnstwist            jlog                openapi-generator   youtube-dl
doitlive            jsoncpp             openconnect
dosbox              klavaro             openrct2
dscanner            kore                opensaml

==> Installing dependencies for nginx: openssl and pcre
==> Installing nginx dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2s.mojave.bottl
==> Downloading from https://akamai.bintray.com/c4/c4a762d719c2be74ac686f1aafabb
######################################################################## 100.0%
==> Pouring openssl-1.0.2s.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

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

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

==> Summary
?  /usr/local/Cellar/openssl/1.0.2s: 1,795 files, 12.0MB
==> Installing nginx dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.43.mojave.bottle.tar
Already downloaded: /Users/apple/Library/Caches/Homebrew/downloads/1b7cb2cf34420d2f3d54b8e13288869193823eaff14a83f0f38be292f7c0e488--pcre-8.43.mojave.bottle.tar.gz
==> Pouring pcre-8.43.mojave.bottle.tar.gz
?  /usr/local/Cellar/pcre/8.43: 204 files, 5.5MB
==> Installing nginx
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.17.1.mojave.bottle.
==> Downloading from https://akamai.bintray.com/a1/a1114fd86181db06ebb31c5f3fb5e
######################################################################## 100.0%
==> Pouring nginx-1.17.1.mojave.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.17.1: 25 files, 2MB
==> Caveats
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

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

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

==> 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

#brew services stop nginx

#brew services restart nginx

查看Nginx的信息:

#nginx -V

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/10508.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!