在macOS Sierra 10.12上安装Apache

检查MacOS中预装的Apache。

启动

<コンピューター名>:~ <ユーザー名>$ sudo apachectl start
Password:

停下来

<コンピューター名>:~ <ユーザー名>$ sudo apachectl stop

使用Homebrew进行安装。

<コンピューター名>:~ <ユーザー名>$ brew search httpd
==> Formulae
darkhttpd                                lighttpd
httpd                                    mighttpd2
httpdiff                                 homebrew/linuxbrew-core/httpd
libmicrohttpd
<コンピューター名>:~ <ユーザー名>$ brew list | grep httpd
<コンピューター名>:~ <ユーザー名>$ brew search httpd
==> Formulae
darkhttpd                                lighttpd
httpd                                    mighttpd2
httpdiff                                 homebrew/linuxbrew-core/httpd
libmicrohttpd
<コンピューター名>:~ <ユーザー名>$ brew install httpd
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
pipx
==> Updated Formulae
allureofthestars           interactive-rebase-tool    pulumi
awscli                     joplin                     pumba
bettercap                  klavaro                    pushpin
bit                        libgaiagraphics            qt
bluepill                   libgeotiff                 rustup-init
bzt                        liblas                     sbcl
camlp4                     libmatroska                shpotify
cloc                       librasterlite              sipsak
diff-pdf                   mariadb@10.1               sonobuoy
docker-credential-helper   mercurial                  sourcekitten
dovecot                    mkvtoolnix                 step
etcd                       mosquitto                  swig
evince                     mu                         taskell
faas-cli                   nexus                      tmux
fonttools                  node                       tor
gdal                       node@10                    torsocks
ghq                        nodenv                     translate-shell
glib                       pdal                       txr
glib-networking            pdftoipe                   unp64
gmic                       php                        unrar
grafana                    php@7.1                    velero
gssdp                      php@7.2                    vulkan-headers
gupnp                      plantuml                   yara
hugo                       pmd                        youtube-dl
imagemagick                poppler                    zola
imagemagick@6              prototool
==> Deleted Formulae
imapsync                                 node@6

==> Installing dependencies for httpd: apr, apr-util, brotli, c-ares, jansson, jemalloc, libev, libevent, nghttp2, pcre
==> Installing httpd dependency: apr
==> Downloading https://homebrew.bintray.com/bottles/apr-1.7.0.sierra.bottle.tar
######################################################################## 100.0%
==> Pouring apr-1.7.0.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.

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

==> Summary
?  /usr/local/Cellar/apr/1.7.0: 59 files, 1.4MB
==> Installing httpd dependency: apr-util
==> Downloading https://homebrew.bintray.com/bottles/apr-util-1.6.1_1.sierra.bot
######################################################################## 100.0%
==> Pouring apr-util-1.6.1_1.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.

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

==> Summary
?  /usr/local/Cellar/apr-util/1.6.1_1: 54 files, 778.3KB
==> Installing httpd dependency: brotli
==> Downloading https://homebrew.bintray.com/bottles/brotli-1.0.7.sierra.bottle.
######################################################################## 100.0%
==> Pouring brotli-1.0.7.sierra.bottle.tar.gz
?  /usr/local/Cellar/brotli/1.0.7: 25 files, 2.2MB
==> Installing httpd dependency: c-ares
==> Downloading https://homebrew.bintray.com/bottles/c-ares-1.15.0.sierra.bottle
######################################################################## 100.0%
==> Pouring c-ares-1.15.0.sierra.bottle.tar.gz
?  /usr/local/Cellar/c-ares/1.15.0: 72 files, 483.7KB
==> Installing httpd dependency: jansson
==> Downloading https://homebrew.bintray.com/bottles/jansson-2.12.sierra.bottle.
######################################################################## 100.0%
==> Pouring jansson-2.12.sierra.bottle.tar.gz
?  /usr/local/Cellar/jansson/2.12: 11 files, 157.9KB
==> Installing httpd dependency: jemalloc
==> Downloading https://homebrew.bintray.com/bottles/jemalloc-5.2.0.sierra.bottl
######################################################################## 100.0%
==> Pouring jemalloc-5.2.0.sierra.bottle.tar.gz
?  /usr/local/Cellar/jemalloc/5.2.0: 16 files, 1.9MB
==> Installing httpd dependency: libev
==> Downloading https://homebrew.bintray.com/bottles/libev-4.24.sierra.bottle.ta
######################################################################## 100.0%
==> Pouring libev-4.24.sierra.bottle.tar.gz
?  /usr/local/Cellar/libev/4.24: 12 files, 432.2KB
==> Installing httpd dependency: libevent
==> Downloading https://homebrew.bintray.com/bottles/libevent-2.1.8.sierra.bottl
######################################################################## 100.0%
==> Pouring libevent-2.1.8.sierra.bottle.tar.gz
?  /usr/local/Cellar/libevent/2.1.8: 847 files, 2.2MB
==> Installing httpd dependency: nghttp2
==> Downloading https://homebrew.bintray.com/bottles/nghttp2-1.38.0.sierra.bottl
######################################################################## 100.0%
==> Pouring nghttp2-1.38.0.sierra.bottle.tar.gz
?  /usr/local/Cellar/nghttp2/1.38.0: 26 files, 2.7MB
==> Installing httpd dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.43.sierra.bottle.tar
######################################################################## 100.0%
==> Pouring pcre-8.43.sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pcre-config
Target /usr/local/bin/pcre-config
is a symlink belonging to pcre. You can unlink it:
  brew unlink pcre

To force the link and overwrite all conflicting files:
  brew link --overwrite pcre

To list all files that would be deleted:
  brew link --overwrite --dry-run pcre

Possible conflicting files are:
/usr/local/bin/pcre-config -> /usr/local/Cellar/pcre/8.36/bin/pcre-config
/usr/local/bin/pcregrep -> /usr/local/Cellar/pcre/8.36/bin/pcregrep
/usr/local/bin/pcretest -> /usr/local/Cellar/pcre/8.36/bin/pcretest
/usr/local/include/pcre.h -> /usr/local/Cellar/pcre/8.36/include/pcre.h
/usr/local/include/pcre_scanner.h -> /usr/local/Cellar/pcre/8.36/include/pcre_scanner.h
/usr/local/include/pcre_stringpiece.h -> /usr/local/Cellar/pcre/8.36/include/pcre_stringpiece.h
/usr/local/include/pcrecpp.h -> /usr/local/Cellar/pcre/8.36/include/pcrecpp.h
/usr/local/include/pcrecpparg.h -> /usr/local/Cellar/pcre/8.36/include/pcrecpparg.h
/usr/local/include/pcreposix.h -> /usr/local/Cellar/pcre/8.36/include/pcreposix.h
/usr/local/share/doc/pcre/AUTHORS
/usr/local/share/doc/pcre/COPYING
/usr/local/share/doc/pcre/ChangeLog
/usr/local/share/doc/pcre/LICENCE
/usr/local/share/doc/pcre/NEWS
/usr/local/share/doc/pcre/README
/usr/local/share/doc/pcre/html/NON-AUTOTOOLS-BUILD.txt
/usr/local/share/doc/pcre/html/README.txt
/usr/local/share/doc/pcre/html/index.html
/usr/local/share/doc/pcre/html/pcre-config.html
/usr/local/share/doc/pcre/html/pcre.html
/usr/local/share/doc/pcre/html/pcre16.html
/usr/local/share/doc/pcre/html/pcre32.html
/usr/local/share/doc/pcre/html/pcre_assign_jit_stack.html
/usr/local/share/doc/pcre/html/pcre_compile.html
/usr/local/share/doc/pcre/html/pcre_compile2.html
/usr/local/share/doc/pcre/html/pcre_config.html
/usr/local/share/doc/pcre/html/pcre_copy_named_substring.html
/usr/local/share/doc/pcre/html/pcre_copy_substring.html
/usr/local/share/doc/pcre/html/pcre_dfa_exec.html
/usr/local/share/doc/pcre/html/pcre_exec.html
/usr/local/share/doc/pcre/html/pcre_free_study.html
/usr/local/share/doc/pcre/html/pcre_free_substring.html
/usr/local/share/doc/pcre/html/pcre_free_substring_list.html
/usr/local/share/doc/pcre/html/pcre_fullinfo.html
/usr/local/share/doc/pcre/html/pcre_get_named_substring.html
/usr/local/share/doc/pcre/html/pcre_get_stringnumber.html
/usr/local/share/doc/pcre/html/pcre_get_stringtable_entries.html
/usr/local/share/doc/pcre/html/pcre_get_substring.html
/usr/local/share/doc/pcre/html/pcre_get_substring_list.html
/usr/local/share/doc/pcre/html/pcre_jit_exec.html
/usr/local/share/doc/pcre/html/pcre_jit_stack_alloc.html
/usr/local/share/doc/pcre/html/pcre_jit_stack_free.html
/usr/local/share/doc/pcre/html/pcre_maketables.html
/usr/local/share/doc/pcre/html/pcre_pattern_to_host_byte_order.html
/usr/local/share/doc/pcre/html/pcre_refcount.html
/usr/local/share/doc/pcre/html/pcre_study.html
/usr/local/share/doc/pcre/html/pcre_utf16_to_host_byte_order.html
/usr/local/share/doc/pcre/html/pcre_utf32_to_host_byte_order.html
/usr/local/share/doc/pcre/html/pcre_version.html
/usr/local/share/doc/pcre/html/pcreapi.html
/usr/local/share/doc/pcre/html/pcrebuild.html
/usr/local/share/doc/pcre/html/pcrecallout.html
/usr/local/share/doc/pcre/html/pcrecompat.html
/usr/local/share/doc/pcre/html/pcrecpp.html
/usr/local/share/doc/pcre/html/pcredemo.html
/usr/local/share/doc/pcre/html/pcregrep.html
/usr/local/share/doc/pcre/html/pcrejit.html
/usr/local/share/doc/pcre/html/pcrelimits.html
/usr/local/share/doc/pcre/html/pcrematching.html
/usr/local/share/doc/pcre/html/pcrepartial.html
/usr/local/share/doc/pcre/html/pcrepattern.html
/usr/local/share/doc/pcre/html/pcreperform.html
/usr/local/share/doc/pcre/html/pcreposix.html
/usr/local/share/doc/pcre/html/pcreprecompile.html
/usr/local/share/doc/pcre/html/pcresample.html
/usr/local/share/doc/pcre/html/pcrestack.html
/usr/local/share/doc/pcre/html/pcresyntax.html
/usr/local/share/doc/pcre/html/pcretest.html
/usr/local/share/doc/pcre/html/pcreunicode.html
/usr/local/share/doc/pcre/pcre-config.txt
/usr/local/share/doc/pcre/pcre.txt
/usr/local/share/doc/pcre/pcregrep.txt
/usr/local/share/doc/pcre/pcretest.txt
/usr/local/share/doc/pcre/AUTHORS
/usr/local/share/doc/pcre/COPYING
/usr/local/share/doc/pcre/ChangeLog
/usr/local/share/doc/pcre/LICENCE
/usr/local/share/doc/pcre/NEWS
/usr/local/share/doc/pcre/README
/usr/local/share/doc/pcre/html/NON-AUTOTOOLS-BUILD.txt
/usr/local/share/doc/pcre/html/README.txt
/usr/local/share/doc/pcre/html/index.html
/usr/local/share/doc/pcre/html/pcre-config.html
/usr/local/share/doc/pcre/html/pcre.html
/usr/local/share/doc/pcre/html/pcre16.html
/usr/local/share/doc/pcre/html/pcre32.html
/usr/local/share/doc/pcre/html/pcre_assign_jit_stack.html
/usr/local/share/doc/pcre/html/pcre_compile.html
/usr/local/share/doc/pcre/html/pcre_compile2.html
/usr/local/share/doc/pcre/html/pcre_config.html
/usr/local/share/doc/pcre/html/pcre_copy_named_substring.html
/usr/local/share/doc/pcre/html/pcre_copy_substring.html
/usr/local/share/doc/pcre/html/pcre_dfa_exec.html
/usr/local/share/doc/pcre/html/pcre_exec.html
/usr/local/share/doc/pcre/html/pcre_free_study.html
/usr/local/share/doc/pcre/html/pcre_free_substring.html
/usr/local/share/doc/pcre/html/pcre_free_substring_list.html
/usr/local/share/doc/pcre/html/pcre_fullinfo.html
/usr/local/share/doc/pcre/html/pcre_get_named_substring.html
/usr/local/share/doc/pcre/html/pcre_get_stringnumber.html
/usr/local/share/doc/pcre/html/pcre_get_stringtable_entries.html
/usr/local/share/doc/pcre/html/pcre_get_substring.html
/usr/local/share/doc/pcre/html/pcre_get_substring_list.html
/usr/local/share/doc/pcre/html/pcre_jit_exec.html
/usr/local/share/doc/pcre/html/pcre_jit_stack_alloc.html
/usr/local/share/doc/pcre/html/pcre_jit_stack_free.html
/usr/local/share/doc/pcre/html/pcre_maketables.html
/usr/local/share/doc/pcre/html/pcre_pattern_to_host_byte_order.html
/usr/local/share/doc/pcre/html/pcre_refcount.html
/usr/local/share/doc/pcre/html/pcre_study.html
/usr/local/share/doc/pcre/html/pcre_utf16_to_host_byte_order.html
/usr/local/share/doc/pcre/html/pcre_utf32_to_host_byte_order.html
/usr/local/share/doc/pcre/html/pcre_version.html
/usr/local/share/doc/pcre/html/pcreapi.html
/usr/local/share/doc/pcre/html/pcrebuild.html
/usr/local/share/doc/pcre/html/pcrecallout.html
/usr/local/share/doc/pcre/html/pcrecompat.html
/usr/local/share/doc/pcre/html/pcrecpp.html
/usr/local/share/doc/pcre/html/pcredemo.html
/usr/local/share/doc/pcre/html/pcregrep.html
/usr/local/share/doc/pcre/html/pcrejit.html
/usr/local/share/doc/pcre/html/pcrelimits.html
/usr/local/share/doc/pcre/html/pcrematching.html
/usr/local/share/doc/pcre/html/pcrepartial.html
/usr/local/share/doc/pcre/html/pcrepattern.html
/usr/local/share/doc/pcre/html/pcreperform.html
/usr/local/share/doc/pcre/html/pcreposix.html
/usr/local/share/doc/pcre/html/pcreprecompile.html
/usr/local/share/doc/pcre/html/pcresample.html
/usr/local/share/doc/pcre/html/pcrestack.html
/usr/local/share/doc/pcre/html/pcresyntax.html
/usr/local/share/doc/pcre/html/pcretest.html
/usr/local/share/doc/pcre/html/pcreunicode.html
/usr/local/share/doc/pcre/pcre-config.txt
/usr/local/share/doc/pcre/pcre.txt
/usr/local/share/doc/pcre/pcregrep.txt
/usr/local/share/doc/pcre/pcretest.txt
/usr/local/share/man/man1/pcre-config.1 -> /usr/local/Cellar/pcre/8.36/share/man/man1/pcre-config.1
/usr/local/share/man/man1/pcregrep.1 -> /usr/local/Cellar/pcre/8.36/share/man/man1/pcregrep.1
/usr/local/share/man/man1/pcretest.1 -> /usr/local/Cellar/pcre/8.36/share/man/man1/pcretest.1
/usr/local/share/man/man3/pcre.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre.3
/usr/local/share/man/man3/pcre16.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16.3
/usr/local/share/man/man3/pcre16_assign_jit_stack.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_assign_jit_stack.3
/usr/local/share/man/man3/pcre16_compile.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_compile.3
/usr/local/share/man/man3/pcre16_compile2.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_compile2.3
/usr/local/share/man/man3/pcre16_config.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_config.3
/usr/local/share/man/man3/pcre16_copy_named_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_copy_named_substring.3
/usr/local/share/man/man3/pcre16_copy_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_copy_substring.3
/usr/local/share/man/man3/pcre16_dfa_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_dfa_exec.3
/usr/local/share/man/man3/pcre16_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_exec.3
/usr/local/share/man/man3/pcre16_free_study.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_free_study.3
/usr/local/share/man/man3/pcre16_free_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_free_substring.3
/usr/local/share/man/man3/pcre16_free_substring_list.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_free_substring_list.3
/usr/local/share/man/man3/pcre16_fullinfo.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_fullinfo.3
/usr/local/share/man/man3/pcre16_get_named_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_get_named_substring.3
/usr/local/share/man/man3/pcre16_get_stringnumber.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_get_stringnumber.3
/usr/local/share/man/man3/pcre16_get_stringtable_entries.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_get_stringtable_entries.3
/usr/local/share/man/man3/pcre16_get_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_get_substring.3
/usr/local/share/man/man3/pcre16_get_substring_list.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_get_substring_list.3
/usr/local/share/man/man3/pcre16_jit_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_jit_exec.3
/usr/local/share/man/man3/pcre16_jit_stack_alloc.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_jit_stack_alloc.3
/usr/local/share/man/man3/pcre16_jit_stack_free.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_jit_stack_free.3
/usr/local/share/man/man3/pcre16_maketables.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_maketables.3
/usr/local/share/man/man3/pcre16_pattern_to_host_byte_order.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_pattern_to_host_byte_order.3
/usr/local/share/man/man3/pcre16_refcount.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_refcount.3
/usr/local/share/man/man3/pcre16_study.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_study.3
/usr/local/share/man/man3/pcre16_utf16_to_host_byte_order.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_utf16_to_host_byte_order.3
/usr/local/share/man/man3/pcre16_version.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre16_version.3
/usr/local/share/man/man3/pcre32.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32.3
/usr/local/share/man/man3/pcre32_assign_jit_stack.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_assign_jit_stack.3
/usr/local/share/man/man3/pcre32_compile.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_compile.3
/usr/local/share/man/man3/pcre32_compile2.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_compile2.3
/usr/local/share/man/man3/pcre32_config.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_config.3
/usr/local/share/man/man3/pcre32_copy_named_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_copy_named_substring.3
/usr/local/share/man/man3/pcre32_copy_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_copy_substring.3
/usr/local/share/man/man3/pcre32_dfa_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_dfa_exec.3
/usr/local/share/man/man3/pcre32_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_exec.3
/usr/local/share/man/man3/pcre32_free_study.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_free_study.3
/usr/local/share/man/man3/pcre32_free_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_free_substring.3
/usr/local/share/man/man3/pcre32_free_substring_list.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_free_substring_list.3
/usr/local/share/man/man3/pcre32_fullinfo.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_fullinfo.3
/usr/local/share/man/man3/pcre32_get_named_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_get_named_substring.3
/usr/local/share/man/man3/pcre32_get_stringnumber.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_get_stringnumber.3
/usr/local/share/man/man3/pcre32_get_stringtable_entries.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_get_stringtable_entries.3
/usr/local/share/man/man3/pcre32_get_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_get_substring.3
/usr/local/share/man/man3/pcre32_get_substring_list.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_get_substring_list.3
/usr/local/share/man/man3/pcre32_jit_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_jit_exec.3
/usr/local/share/man/man3/pcre32_jit_stack_alloc.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_jit_stack_alloc.3
/usr/local/share/man/man3/pcre32_jit_stack_free.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_jit_stack_free.3
/usr/local/share/man/man3/pcre32_maketables.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_maketables.3
/usr/local/share/man/man3/pcre32_pattern_to_host_byte_order.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_pattern_to_host_byte_order.3
/usr/local/share/man/man3/pcre32_refcount.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_refcount.3
/usr/local/share/man/man3/pcre32_study.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_study.3
/usr/local/share/man/man3/pcre32_utf32_to_host_byte_order.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_utf32_to_host_byte_order.3
/usr/local/share/man/man3/pcre32_version.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre32_version.3
/usr/local/share/man/man3/pcre_assign_jit_stack.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_assign_jit_stack.3
/usr/local/share/man/man3/pcre_compile.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_compile.3
/usr/local/share/man/man3/pcre_compile2.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_compile2.3
/usr/local/share/man/man3/pcre_config.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_config.3
/usr/local/share/man/man3/pcre_copy_named_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_copy_named_substring.3
/usr/local/share/man/man3/pcre_copy_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_copy_substring.3
/usr/local/share/man/man3/pcre_dfa_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_dfa_exec.3
/usr/local/share/man/man3/pcre_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_exec.3
/usr/local/share/man/man3/pcre_free_study.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_free_study.3
/usr/local/share/man/man3/pcre_free_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_free_substring.3
/usr/local/share/man/man3/pcre_free_substring_list.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_free_substring_list.3
/usr/local/share/man/man3/pcre_fullinfo.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_fullinfo.3
/usr/local/share/man/man3/pcre_get_named_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_get_named_substring.3
/usr/local/share/man/man3/pcre_get_stringnumber.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_get_stringnumber.3
/usr/local/share/man/man3/pcre_get_stringtable_entries.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_get_stringtable_entries.3
/usr/local/share/man/man3/pcre_get_substring.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_get_substring.3
/usr/local/share/man/man3/pcre_get_substring_list.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_get_substring_list.3
/usr/local/share/man/man3/pcre_jit_exec.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_jit_exec.3
/usr/local/share/man/man3/pcre_jit_stack_alloc.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_jit_stack_alloc.3
/usr/local/share/man/man3/pcre_jit_stack_free.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_jit_stack_free.3
/usr/local/share/man/man3/pcre_maketables.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_maketables.3
/usr/local/share/man/man3/pcre_pattern_to_host_byte_order.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_pattern_to_host_byte_order.3
/usr/local/share/man/man3/pcre_refcount.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_refcount.3
/usr/local/share/man/man3/pcre_study.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_study.3
/usr/local/share/man/man3/pcre_utf16_to_host_byte_order.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_utf16_to_host_byte_order.3
/usr/local/share/man/man3/pcre_utf32_to_host_byte_order.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_utf32_to_host_byte_order.3
/usr/local/share/man/man3/pcre_version.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcre_version.3
/usr/local/share/man/man3/pcreapi.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcreapi.3
/usr/local/share/man/man3/pcrebuild.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrebuild.3
/usr/local/share/man/man3/pcrecallout.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrecallout.3
/usr/local/share/man/man3/pcrecompat.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrecompat.3
/usr/local/share/man/man3/pcrecpp.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrecpp.3
/usr/local/share/man/man3/pcredemo.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcredemo.3
/usr/local/share/man/man3/pcrejit.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrejit.3
/usr/local/share/man/man3/pcrelimits.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrelimits.3
/usr/local/share/man/man3/pcrematching.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrematching.3
/usr/local/share/man/man3/pcrepartial.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrepartial.3
/usr/local/share/man/man3/pcrepattern.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrepattern.3
/usr/local/share/man/man3/pcreperform.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcreperform.3
/usr/local/share/man/man3/pcreposix.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcreposix.3
/usr/local/share/man/man3/pcreprecompile.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcreprecompile.3
/usr/local/share/man/man3/pcresample.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcresample.3
/usr/local/share/man/man3/pcrestack.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcrestack.3
/usr/local/share/man/man3/pcresyntax.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcresyntax.3
/usr/local/share/man/man3/pcreunicode.3 -> /usr/local/Cellar/pcre/8.36/share/man/man3/pcreunicode.3
/usr/local/lib/libpcre.1.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcre.1.dylib
/usr/local/lib/libpcre.a -> /usr/local/Cellar/pcre/8.36/lib/libpcre.a
/usr/local/lib/libpcre.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcre.dylib
/usr/local/lib/libpcre16.0.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcre16.0.dylib
/usr/local/lib/libpcre16.a -> /usr/local/Cellar/pcre/8.36/lib/libpcre16.a
/usr/local/lib/libpcre16.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcre16.dylib
/usr/local/lib/libpcre32.0.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcre32.0.dylib
/usr/local/lib/libpcre32.a -> /usr/local/Cellar/pcre/8.36/lib/libpcre32.a
/usr/local/lib/libpcre32.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcre32.dylib
/usr/local/lib/libpcrecpp.0.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcrecpp.0.dylib
/usr/local/lib/libpcrecpp.a -> /usr/local/Cellar/pcre/8.36/lib/libpcrecpp.a
/usr/local/lib/libpcrecpp.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcrecpp.dylib
/usr/local/lib/libpcreposix.0.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcreposix.0.dylib
/usr/local/lib/libpcreposix.a -> /usr/local/Cellar/pcre/8.36/lib/libpcreposix.a
/usr/local/lib/libpcreposix.dylib -> /usr/local/Cellar/pcre/8.36/lib/libpcreposix.dylib
/usr/local/lib/pkgconfig/libpcre.pc -> /usr/local/Cellar/pcre/8.36/lib/pkgconfig/libpcre.pc
/usr/local/lib/pkgconfig/libpcre16.pc -> /usr/local/Cellar/pcre/8.36/lib/pkgconfig/libpcre16.pc
/usr/local/lib/pkgconfig/libpcre32.pc -> /usr/local/Cellar/pcre/8.36/lib/pkgconfig/libpcre32.pc
/usr/local/lib/pkgconfig/libpcrecpp.pc -> /usr/local/Cellar/pcre/8.36/lib/pkgconfig/libpcrecpp.pc
/usr/local/lib/pkgconfig/libpcreposix.pc -> /usr/local/Cellar/pcre/8.36/lib/pkgconfig/libpcreposix.pc
==> Summary
?  /usr/local/Cellar/pcre/8.43: 204 files, 5.3MB
==> Installing httpd
==> Downloading https://homebrew.bintray.com/bottles/httpd-2.4.39.sierra.bottle.
######################################################################## 100.0%
==> Pouring httpd-2.4.39.sierra.bottle.tar.gz
==> Caveats
DocumentRoot is /usr/local/var/www.

The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in
/usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

To have launchd start httpd now and restart at login:
  brew services start httpd
Or, if you don't want/need a background service you can just run:
  apachectl start
==> Summary
?  /usr/local/Cellar/httpd/2.4.39: 1,649 files, 27.0MB
==> Caveats
==> apr
This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.

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

==> apr-util
This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.

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

==> httpd
DocumentRoot is /usr/local/var/www.

The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in
/usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

To have launchd start httpd now and restart at login:
  brew services start httpd
Or, if you don't want/need a background service you can just run:
  apachectl start

确认操作,确认现有的Apache服务正在运行。

$ which httpd
/usr/sbin/httpd
$ httpd -v
Server version: Apache/2.4.23 (Unix)
Server built: Aug 8 2016 16:31:34

执行brew doctor

$ brew doctor

以下是显示的内容(部分摘录)

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
  echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

在.bash_profile文件中添加内容

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

再次确认后,可以看到通过Homebrew安装的Apache正在运行。

$ which httpd
/usr/local/bin/httpd
$ httpd -v
Server version: Apache/2.4.39 (Unix)
Server built: Apr 19 2019 17:55:18

通过Homebrew安装的Apache的端口设置为8080,所以在 http://localhost:8080 访问时会显示”It works!”。

让http://localhost从这里可以访问。

修改Apache的设置

请编辑以下配置文件:
/usr/local/etc/httpd/httpd.conf

由于默认端口为8080,将其更改为80。

改变前

Listen 8080

改变之后

Listen 80

更改文档根目录

更改前

DocumentRoot "/usr/local/var/www"

修改后

DocumentRoot /Users/<ユーザー名>/Sites

根据文档根目录的更改,修改目录标签的目录路径。

之前的更改

<Directory "/usr/local/var/www">

修改以后

<Directory /Users/<ユーザー名>/Sites>

为了使其可以通过htaccess进行设置,需要更改目录标记内的AllowOverride设置。

改变以前

AllowOverride None

更改之后

AllowOverride All

将加载mod_rewrite进行重定向和URL重写。

改变之前

#LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so

更改后

LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so

为解决访问主目录时出现的权限问题,可以尝试更改Apache的执行用户。

User Sites
Group daemon
User <ユーザー名>
Group Staff

修改服务器名称

#ServerName www.example.com:8080
ServerName localhost

通过这样做,将会显示已将文件夹设置为文档根目录的位置在 http://localhost 上。

进行虚拟主机设置

编辑”/user/local/etc/httpd/httpd.conf”文件,去掉注释并使其生效。

# Virtual hosts
Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

将配置添加到 /user/local/etc/httpd/extra/httpd-vhosts.conf 文件中。

<VirtualHost *:80>
   DocumentRoot "/Users/<ユーザー名>/Sites/<フォルダ名>"
   ServerName <例)localhost.test.com>
   <Directory "/Users/<ユーザー名>/Sites/<フォルダ名>">
       Require all granted
       DirectoryIndex index.html
       Options Includes
   </Directory>
</VirtualHost>

编辑并追加 /etc/hosts 文件

127.0.0.1   <例)localhost.test.com>
::1             <例)localhost.test.com>

重新启动Apache并在浏览器中访问localhost.test.com

sudo apachectl restart

请提供下列信息中文的本地重述,只需提供一种选项:

请参考

以下是三个关于macOS和Apache服务器的链接:

1. https://qiita.com/ponsuke0531/items/ac257b112c1712114931
2. https://weblabo.oscasierra.net/apache-macos-install-homebrew/
3. https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions

广告
将在 10 秒后关闭
bannerAds