? my $ctx = $main::context; ? $_mt->wrapper_file("wrapper.mt", "Install")->(sub {
Thanks to others, H2O is provided as a binary package on some environments. Therefore you may try to at first install the software using your favorite packaging system, and then resort to installing from source as described below.
At the time being, following packages are known to be actively maintained= $ctx->{note}->(q{Please open a new issue on Github if you want a new package to get added.}) ?>:
Download a release version from the releases page or clone the master branch from the source repository, and build it using CMake= $ctx->{note}->("CMake is a popular build tool that can be found as a binary package on most operating systems.") ?>.
= $ctx->{code}->(<< 'EOT') % cmake -DWITH_BUNDLED_SSL=on . % make % sudo make install EOT ?>
When complete, H2O will be installed under /usr/local
.
Start the installed server using the example configuration to confirm that it actually works (note: without the use of -m
option the server runs as a foreground process; press Ctrl-C
to stop).
The example configuration starts a server that listens to port 8080 (HTTP) and port 8081 (HTTPS). Try to access the ports using the protocols respectively (note: when accessing via HTTPS it is likely that you would see hostname mismatch errors reported by the web browsers).
When complete, proceed to Configure section for how to setup the server.
Following list shows the interesting arguments recognized by CMake.
-DCMAKE_INSTALL_PREFIX=directory
/usr/local
).
-DWITH_BUNDLED_SSL=on|off
off
if OpenSSL version >= 1.0.2 is found, on
if otherwise). Read the section below for comparison between OpenSSL and LibreSSL.
-DWITH_MRUBY=on|off
mkmf
- a program for building ruby extensions is required. In many distributions, the program is packaged as part of ruby-dev or ruby-devel
package.}) ?>) are found.
Generally speaking, we believe that using LibreSSL is a better choice for running H2O, since LibreSSL not only is considered to be more secure than OpenSSL but also provides support for new ciphersuites such as chacha20-poly1305
which is the preferred method of Google Chrome= $ctx->{note}->(q{ref: Do the ChaCha: better mobile performance with cryptography}) ?>. However, it is also true that LibreSSL is slower than OpenSSL on some benchmarks. So if you are interested in benchmark numbers, using OpenSSL is a reasonable choice.
The difficulty in using OpenSSL is that the HTTP/2 specification requires the use of an extension to the TLS protocol named ALPN, which has only been supported since OpenSSL 1.0.2= $ctx->{note}->("It is possible to build H2O using prior versions of OpenSSL, but some (if not all) web browsers are known for not using HTTP/2 when connecting to servers configured as such.") ?>. Therefore it is highly likely that you would need to manually install or upgrade OpenSSL on your system.
Once you have installed OpenSSL 1.0.2, it is possible to build H2O that links against the library. As an safeguard it is advised to use -DWITH_BUNDLED_SSL
set to off
, so that the server would not accidentally link against the bundled LibreSSL.
CMake will search for OpenSSL by looking at the default search paths.
Two ways exist to specify the directory in which CMake should search for OpenSSL.
The preferred approach is to use the PKG_CONFIG_PATH
environment variable.
In case your OpenSSL installation does not have the lib/pkgconfig
directory, you may use OPENSSL_ROOT_DIR
environment variable to specify the root directory of the OpenSSL being installed. However, it is likely that CMake version 3.1.2 or above is be required when using this approach= $ctx->{note}->(q{ref: h2o issue #277, CMake issue 0015386}) ?>.