UJP - brewでインストールしたhttpdを起動する

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

  • カテゴリ 2008 13inch 1 の最新配信
  • RSS
  • RDF
  • ATOM

ブログ - brewでインストールしたhttpdを起動する

brewでインストールしたhttpdを起動する

カテゴリ : 
Apple » MacBook » 2008 13inch 1
ブロガー : 
ujpblog 2019/4/12 19:46
 brew infoで,インストールした時の情報を確認.
$ brew info httpd🆑
httpd: stable 2.4.38
Apache HTTP server
https://httpd.apache.org/
/usr/local/Cellar/httpd/2.4.38 (1,613 files, 26.4MB) *
  Built from source on 2019-04-10 at 23:36:23
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/httpd.rb
==> Dependencies
Required: apr ✔, apr-util ✔, brotli ✔, nghttp2 ✘, openssl ✔, pcre ✔
==> 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🈁
==> Analytics
install: 12,837 (30 days), 45,067 (90 days), 174,047 (365 days)
install_on_request: 10,475 (30 days), 34,852 (90 days), 132,302 (365 days)
build_error: 0 (30 days)
$
 nghttp2が入ってない.今回はコンパイルできないのだから仕方ない.
 ドキュメントを配置するhtdocの場所を確認.
$ ls -la /usr/local/var/www🆑
total 4
drwxr-xr-x 4 server admin 136  4 10 23:36 .
drwxrwxr-x 8 server admin 272  4 10 23:36 ..
drwxr-xr-x 6 server admin 204  4 10 23:36 cgi-bin
-rw-r--r-- 1 server admin  45  6 12  2007 index.html🈁
 index.htmlファイルを確認.
$ cat /usr/local/var/www/index.html🆑
<html><body><h1>It works!</h1></body></html>
$
 一番軽いやつだ.
 次に,httpd.confを確認.ブランク行やコメント行を削除する.
$ grep -v -e '^\s*#' -e '^\s*$' /usr/local/etc/httpd/httpd.conf🆑
ServerRoot "/usr/local/opt/httpd"
Listen 8080
LoadModule mpm_prefork_module lib/httpd/modules/mod_mpm_prefork.so
LoadModule authn_file_module lib/httpd/modules/mod_authn_file.so
LoadModule authn_core_module lib/httpd/modules/mod_authn_core.so
LoadModule authz_host_module lib/httpd/modules/mod_authz_host.so
LoadModule authz_groupfile_module lib/httpd/modules/mod_authz_groupfile.so
LoadModule authz_user_module lib/httpd/modules/mod_authz_user.so
LoadModule authz_core_module lib/httpd/modules/mod_authz_core.so
LoadModule access_compat_module lib/httpd/modules/mod_access_compat.so
LoadModule auth_basic_module lib/httpd/modules/mod_auth_basic.so
LoadModule reqtimeout_module lib/httpd/modules/mod_reqtimeout.so
LoadModule filter_module lib/httpd/modules/mod_filter.so
LoadModule mime_module lib/httpd/modules/mod_mime.so
LoadModule log_config_module lib/httpd/modules/mod_log_config.so
LoadModule env_module lib/httpd/modules/mod_env.so
LoadModule headers_module lib/httpd/modules/mod_headers.so
LoadModule setenvif_module lib/httpd/modules/mod_setenvif.so
LoadModule version_module lib/httpd/modules/mod_version.so
LoadModule unixd_module lib/httpd/modules/mod_unixd.so
LoadModule status_module lib/httpd/modules/mod_status.so
LoadModule autoindex_module lib/httpd/modules/mod_autoindex.so
<IfModule !mpm_prefork_module>
</IfModule>
<IfModule mpm_prefork_module>
</IfModule>
LoadModule dir_module lib/httpd/modules/mod_dir.so
LoadModule alias_module lib/httpd/modules/mod_alias.so
<IfModule unixd_module>
User _www
Group _www
</IfModule>
ServerAdmin you@example.com
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/usr/local/var/www"
<Directory "/usr/local/var/www">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
ErrorLog "/usr/local/var/log/httpd/error_log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "/usr/local/var/log/httpd/access_log" common🈁
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/var/www/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/usr/local/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
<IfModule headers_module>
    RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
    TypesConfig /usr/local/etc/httpd/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule proxy_html_module>
Include /usr/local/etc/httpd/extra/proxy-html.conf
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
$
SSLの設定を確認.
$ grep -v -e '^\s*#' -e '^\s*$' /usr/local/etc/httpd/extra/httpd-ssl.conf🆑
Listen 8443
SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
SSLHonorCipherOrder on
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
SSLPassPhraseDialog  builtin
SSLSessionCache        "shmcb:/usr/local/var/run/httpd/ssl_scache(512000)"
SSLSessionCacheTimeout  300
<VirtualHost _default_:8443>
DocumentRoot "/usr/local/var/www"
ServerName www.example.com:8443
ServerAdmin you@example.com
ErrorLog "/usr/local/var/log/httpd/error_log"
TransferLog "/usr/local/var/log/httpd/access_log"
SSLEngine on
SSLCertificateFile "/usr/local/etc/httpd/server.crt"
SSLCertificateKeyFile "/usr/local/etc/httpd/server.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/usr/local/var/www/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog "/usr/local/var/log/httpd/ssl_request_log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
$
 そのまま起動できそう.
 apachectlの場所を確認して,起動してみる.
$ which apachectl🆑
/usr/local/bin/apachectl🈁
$ apachectl start🆑
$ ps -ef|grep httpd🆑
  501 77099     1   0  7:39PM ??         0:00.01 /usr/local/opt/httpd/bin/httpd -k start
  501 77100 77099   0  7:39PM ??         0:00.00 /usr/local/opt/httpd/bin/httpd -k start
  501 77101 77099   0  7:39PM ??         0:00.00 /usr/local/opt/httpd/bin/httpd -k start
  501 77102 77099   0  7:39PM ??         0:00.00 /usr/local/opt/httpd/bin/httpd -k start
  501 77103 77099   0  7:39PM ??         0:00.00 /usr/local/opt/httpd/bin/httpd -k start
  501 77104 77099   0  7:39PM ??         0:00.00 /usr/local/opt/httpd/bin/httpd -k start
  501 77106 77050   0  7:39PM ttys002    0:00.00 grep httpd
$
 起動しました.ログを確認.
$ ls -la /usr/local/var/log/httpd/🆑
total 4
drwxr-xr-x 4 server admin 136  4 12 19:39 .
drwxr-xr-x 4 server admin 136  4 11 01:27 ..
-rw-r--r-- 1 server admin   0  4 12 19:39 access_log🈁
-rw-r--r-- 1 server admin 254  4 12 19:39 error_log
$
 ゼロバイト.curlコマンドでアクセスしてみる.
$ curl localhost:8080🆑
<html><body><h1>It works!</h1></body></html>
$
It worksが返ってきた.ログを確認.
$ ls -la /usr/local/var/log/httpd/🆑
total 8
drwxr-xr-x 4 server admin 136  4 12 19:39 .
drwxr-xr-x 4 server admin 136  4 11 01:27 ..
-rw-r--r-- 1 server admin  61  4 12 19:42 access_log🈁
-rw-r--r-- 1 server admin 254  4 12 19:39 error_log
$ cat /usr/local/var/log/httpd/access_log🆑
::1 - - [12/Apr/2019:19:41:59 +0900] "GET / HTTP/1.1" 200 45
$
 問題なくアクセスログが記録されていました.

トラックバック


広告スペース
Google