Apache HTTP Server

提供: Amayus Wiki
Jump to navigation Jump to search

Require[編集]

Install[編集]

  • PCRE 8.43
  • zlib 1.2.11
  • expat 2.2.6
  • APR 1.7.0
  • APR-util 1.6.1
  • Apache HTTP Server 2.4.39

PCRE[編集]

$ wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
$ tar xf pcre-8.43.tar.gz
$ cd pcre-8.43
$ ./configure --prefix=/opt/pcre-8.43
$ make -j2
$ make test
$ sudo make install
$ cd /opt && sudo ln -Tsf pcre-8.43 pcre && cd -
$ cd ..

zlib[編集]

$ wget https://zlib.net/zlib-1.2.11.tar.gz
$ tar xf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure --prefix=/opt/zlib-1.2.11
$ make -j2
$ make test
$ sudo make install
$ cd /opt && sudo ln -Tsf zlib-1.2.11 zlib && cd -
$ cd ..

Brotli[編集]

$ sudo yum install bc autoconf automake libtool
$ wget https://github.com/google/brotli/archive/v1.0.7.tar.gz -O brotli-1.0.7.tar.gz
$ tar xf brotli-1.0.7.tar.gz
$ cd brotli-1.0.7
$ ./bootstrap
$ ./configure --prefix=/opt/brotli-1.0.7
$ sudo make install
$ cd /opt && sudo ln -Tsf brotli-1.0.7 brotli && cd -
$ cd ..

expat[編集]

$ wget https://github.com/libexpat/libexpat/releases/download/R_2_2_6/expat-2.2.6.tar.bz2
$ tar xf expat-2.2.6.tar.bz2
$ ./configure --prefix=/opt/expat-2.2.6
$ make -j2
$ make check
$ sudo make install
$ cd /opt && sudo ln -Tsf expat-2.2.6 expat && cd -

APR[編集]

$ wget http://ftp.riken.jp/net/apache//apr/apr-1.7.0.tar.gz
$ tar xf apr-1.7.0.tar.gz
$ cd apr-1.7.0
$ ./configure --prefix=/opt/apr-1.7.0
$ make -j2
$ make test # failed
$ sudo make install
$ cd /opt && sudo ln -Tsf apr-1.7.0 apr && cd -
$ cd ..

APR util[編集]

$ wget http://ftp.yz.yamagata-u.ac.jp/pub/network/apache//apr/apr-util-1.6.1.tar.gz
$ tar xf apr-util-1.6.1.tar.gz
$ cd apr-util-1.6.1
$ ./configure --prefix=/opt/apr-util-1.6.1 --with-apr=/opt/apr-1.7.0 --with-expat=/opt/expat-2.2.6
$ make -j2
$ make test
$ sudo make install
$ cd /opt && sudo ln -Tsf apr-util-1.6.1 apr-util && cd -
$ cd ..

Apache HTTP Server[編集]

$ wget http://ftp.yz.yamagata-u.ac.jp/pub/network/apache//httpd/httpd-2.4.39.tar.bz2
$ tar xf httpd-2.4.39.tar.bz2
$ cd httpd-2.4.39
$ ./configure \
--prefix=/opt/httpd-2.4.39 \
--with-apr=/opt/apr-1.7.0 \
--with-apr-util=/opt/apr-util-1.6.1 \
--with-pcre=/opt/pcre-8.43 \
--with-z=/opt/zlib-1.2.11 \
--with-brotli=/opt/brotli-1.0.7 \
--enable-mods-static="brotli deflate env log_config logio proxy rewrite setenvif unixd"
$ make -j2
$ sudo make install
$ cd /opt && sudo ln -Tsf httpd-2.4.39 httpd && cd -
$ cd ..
$ ll /opt/httpd/bin/httpd
-rwxr-xr-x 1 root root 3945520 Nov  9 15:32 /opt/httpd/bin/httpd
$ /opt/httpd/bin/httpd -l
Compiled in modules:
  core.c
  mod_so.c
  mod_deflate.c
  mod_brotli.c
  http_core.c
  mod_log_config.c
  mod_logio.c
  mod_env.c
  mod_setenvif.c
  mod_proxy.c
  mod_proxy_connect.c
  mod_proxy_ftp.c
  mod_proxy_http.c
  mod_proxy_fcgi.c
  mod_proxy_scgi.c
  mod_proxy_uwsgi.c
  mod_proxy_fdpass.c
  mod_proxy_wstunnel.c
  mod_proxy_ajp.c
  mod_proxy_balancer.c
  mod_proxy_express.c
  mod_lbmethod_byrequests.c
  mod_lbmethod_bytraffic.c
  mod_lbmethod_bybusyness.c
  mod_lbmethod_heartbeat.c
  event.c
  mod_unixd.c
  mod_rewrite.c
$

設定[編集]

user/group[編集]

$ sudo groupadd -g 48 apache
$ sudo useradd -u 48 -g apache -s /sbin/nologin -M -d /opt/httpd apache

Document root[編集]

$ sudo mkdir -p /var/opt/httpd/htdocs

httpd.conf[編集]

$ sudo mkdir /etc/opt/httpd
$ cd /etc/opt/httpd
$ sudo cp -p /opt/httpd/conf/httpd.conf .
$ sudo vi httpd.conf