0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ApacheをmacOS Sierra 10.12にインストールする

Last updated at Posted at 2019-05-05

#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

#動作確認をするが既存のApacehが動作している

$ 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

##リダイレクトやURLの書き換えを行うmod_rewriteを読み込むように変更する

変更前

#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

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

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?