{"id":387,"date":"2017-05-15T15:58:36","date_gmt":"2017-05-15T06:58:36","guid":{"rendered":"https:\/\/fsck.jp\/?p=387"},"modified":"2018-05-31T09:00:00","modified_gmt":"2018-05-31T00:00:00","slug":"http2%e5%af%be%e5%bf%9c%e3%81%aenginxopenssl%e3%82%92%e3%83%93%e3%83%ab%e3%83%89","status":"publish","type":"post","link":"https:\/\/fsck.jp\/?p=387","title":{"rendered":"HTTP\/2 (ALPN) \u5bfe\u5fdc\u306e nginx \u3092 SRPM \u304b\u3089\u30d3\u30eb\u30c9"},"content":{"rendered":"<p>\u203b\u4ee5\u4e0b\u306fCentOS 7.3\u307e\u3067\u306e\u53e4\u3044\u5185\u5bb9\u3067\u3059\u3002CentOS 7.4 \u3067\u306f OpenSSL 1.0.2 \u304c\u6a19\u6e96\u3068\u306a\u3063\u305f\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u4f5c\u696d\u306f\u4e0d\u8981\u3067\u3059\u3002<\/p>\n<p>CentOS7.3 \u306b\u542b\u307e\u308c\u308b\u6a19\u6e96\u30d1\u30c3\u30b1\u30fc\u30b8\u306e OpenSSL \u304c 1.0.1 \u7cfb\u306a\u306e\u3067\u3001\u305d\u308c\u3092\u30ea\u30f3\u30af\u3057\u3066\u30d3\u30eb\u30c9\u3057\u305f nginx \u516c\u5f0f\u306e\u30d0\u30a4\u30ca\u30ea\u3067\u306f HTTP\/2 (ALPN) \u304c\u5229\u7528\u3067\u304d\u306a\u3044\u3002\u305d\u3053\u3067\u3001openssl-1.0.2 \u7cfb\u306e\u30bd\u30fc\u30b9\u30c4\u30ea\u30fc\u3092\u4f7f\u3063\u3066 nginx \u516c\u5f0f\u306e SRPM \u3092\u30ea\u30d3\u30eb\u30c9\u3059\u308b\u3053\u3068\u3068\u3059\u308b\u3002<\/p>\n<p>\u3064\u3044\u3067\u306b\u3001geoip\u30e2\u30b8\u30e5\u30fc\u30eb\u3068dav_ext\u30e2\u30b8\u30e5\u30fc\u30eb\u3082\u4f7f\u3044\u305f\u3044\u306e\u3067\u3001\u8ffd\u52a0\u3057\u305f\u4e0a\u3067\u30d3\u30eb\u30c9\u3059\u308b\u3002<\/p>\n<h3>1. \u30b3\u30f3\u30d1\u30a4\u30eb\u306b\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p><code>$ sudo yum install expat-devel pcre-devel zlib-devel GeoIP-devel<\/code><\/p>\n<h3>2. nginx\u306e\u516c\u5f0f\u30ec\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0<\/h3>\n<p>\u30ec\u30dd\u30b8\u30c8\u30ea\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\n<code>$ sudo vi \/etc\/yum.repos.d\/nginx.repo<\/code><\/p>\n<pre>\r\n[nginx]\r\nname=nginx repo\r\nbaseurl=http:\/\/nginx.org\/packages\/centos\/$releasever\/$basearch\/\r\ngpgcheck=0\r\nenabled=1\r\n\r\n[nginx-source]\r\nname=nginx repo - Source\r\nbaseurl=http:\/\/nginx.org\/packages\/centos\/$releasever\/SRPMS\/\r\ngpgcheck=0\r\nenabled=1<\/pre>\n<h3>3. \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/h3>\n<p>SRPM\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30fb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<br \/>\n<code>$ sudo yum install -y yum-utils<br \/>\n$ yumdownloader --source nginx<br \/>\n$ rpm -ivh --nosignature nginx-1.12.1-1.el7.ngx.src.rpm<\/code><\/p>\n<p>\u4eca\u5f8cyum update\u3067\u52dd\u624b\u306b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u3001nginx\u30ec\u30dd\u30b8\u30c8\u30ea\u3092\u7121\u52b9\u5316\u3057\u3066\u304a\u304f\u3002<br \/>\n<code>$ sudo yum-config-manager --disable nginx<br \/>\n$ sudo yum-config-manager --disable nginx-source<\/code><\/p>\n<p>OpenSSL 1.0.2 \u306e\u30bd\u30fc\u30b9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5c55\u958b\u3059\u308b\u3002<br \/>\n<code>$ cd \/tmp<br \/>\n$ wget https:\/\/www.openssl.org\/source\/openssl-1.0.2l.tar.gz<br \/>\n$ tar xzf openssl-1.0.2l.tar.gz<br \/>\n$ cd ~<\/code><\/p>\n<p>OpenSSL \u306e\u30d3\u30eb\u30c9\u306f\u3057\u306a\u304f\u3066\u3088\u3044\u3002<\/p>\n<h3>4. \u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/h3>\n<p>SRPM \u306e spec \u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3059\u308b\u3002<br \/>\n<code>$ vi rpmbuild\/SPECS\/nginx.spec<\/code><\/p>\n<p>\u9752\u5b57\u306e\u90e8\u5206\u306f\u8ffd\u52a0\u3001\u8d64\u5b57\u3067\u6253\u6d88\u3057\u7dda\u306e\u3068\u3053\u308d\u306f\u524a\u9664\u3059\u308b\u3002<\/p>\n<pre>\r\n#\r\n%define nginx_home %{_localstatedir}\/cache\/nginx\r\n%define nginx_user nginx\r\n%define nginx_group nginx\r\n%define nginx_loggroup adm\r\n\r\n# distribution specific definitions\r\n%define use_systemd (0%{?fedora} && 0%{?fedora} &gt;= 18) || (0%{?rhel} && 0%{?rhel\r\n} &gt;= 7) || (0%{?suse_version} == 1315)\r\n\r\n%if 0%{?rhel} == 5\r\n%define _group System Environment\/Daemons\r\nRequires(pre): shadow-utils\r\nRequires: initscripts &gt;= 8.36\r\nRequires(post): chkconfig\r\nRequires: openssl\r\nBuildRequires: openssl-devel\r\n%endif\r\n\r\n%if 0%{?rhel} == 6\r\n%define _group System Environment\/Daemons\r\nRequires(pre): shadow-utils\r\nRequires: initscripts &gt;= 8.36\r\nRequires(post): chkconfig\r\nRequires: openssl &gt;= 1.0.1\r\nBuildRequires: openssl-devel &gt;= 1.0.1\r\n%endif\r\n\r\n%if 0%{?rhel} == 7\r\n%define _group System Environment\/Daemons\r\n%define epoch 1\r\nEpoch: %{epoch}\r\nRequires(pre): shadow-utils\r\nRequires: systemd\r\n<span style=\"font-weight:bold;text-decoration:line-through;color:red\">Requires: openssl &gt;= 1.0.1<\/span>\r\nBuildRequires: systemd\r\n<span style=\"font-weight:bold;text-decoration:line-through;color:red\">BuildRequires: openssl-devel &gt;= 1.0.1<\/span>\r\n<span style=\"font-weight:bold;color:blue\">BuildRequires: GeoIP-devel<\/span>\r\n<span style=\"font-weight:bold;color:blue\">BuildRequires: expat-devel<\/span>\r\n%endif\r\n\r\n%if 0%{?suse_version} == 1315\r\n%define _group Productivity\/Networking\/Web\/Servers\r\n%define nginx_loggroup trusted\r\nRequires(pre): shadow\r\nRequires: systemd\r\nBuildRequires: libopenssl-devel\r\nBuildRequires: systemd\r\n%endif\r\n\r\n# end of distribution specific definitions\r\n\r\n%define main_version 1.12.1\r\n%define main_release 1%{?dist}.ngx\r\n\r\n%define bdir %{_builddir}\/%{name}-%{main_version}\r\n\r\n%define WITH_CC_OPT $(echo %{optflags} $(pcre-config --cflags)) -fPIC\r\n%define WITH_LD_OPT -Wl,-z,relro -Wl,-z,now -pie\r\n%define BASE_CONFIGURE_ARGS $(echo &quot;--prefix=%{_sysconfdir}\/nginx --sbin-path=%{\r\n_sbindir}\/nginx --modules-path=%{_libdir}\/nginx\/modules --conf-path=%{_sysconfdi\r\nr}\/nginx\/nginx.conf --error-log-path=%{_localstatedir}\/log\/nginx\/error.log --htt\r\np-log-path=%{_localstatedir}\/log\/nginx\/access.log --pid-path=%{_localstatedir}\/r\r\nun\/nginx.pid --lock-path=%{_localstatedir}\/run\/nginx.lock --http-client-body-tem\r\np-path=%{_localstatedir}\/cache\/nginx\/client_temp --http-proxy-temp-path=%{_local\r\nstatedir}\/cache\/nginx\/proxy_temp --http-fastcgi-temp-path=%{_localstatedir}\/cach\r\ne\/nginx\/fastcgi_temp --http-uwsgi-temp-path=%{_localstatedir}\/cache\/nginx\/uwsgi_\r\ntemp --http-scgi-temp-path=%{_localstatedir}\/cache\/nginx\/scgi_temp --user=%{ngin\r\nx_user} --group=%{nginx_group} --with-compat --with-file-aio --with-threads --wi\r\nth-http_addition_module --with-http_auth_request_module --with-http_dav_module -\r\n-with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module -\r\n-with-http_mp4_module --with-http_random_index_module --with-http_realip_module \r\n--with-http_secure_link_module --with-http_slice_module --with-http_ssl_module -\r\n-with-http_stub_status_module --with-http_sub_module --with-http_v2_module --wit\r\nh-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-s\r\ntream_ssl_module --with-stream_ssl_preread_module <span style=\"font-weight:bold;color:blue\">--with-http_geoip_module --add\r\n-module=.\/nginx-dav-ext-module --with-openssl=\/tmp\/openssl-1.0.2l<\/span>&quot;)\r\n\r\nSummary: High performance web server\r\nName: nginx\r\nVersion: %{main_version}\r\nRelease: %{main_release}\r\nVendor: Nginx, Inc.\r\nURL: http:\/\/nginx.org\/\r\nGroup: %{_group}\r\n\r\nSource0: http:\/\/nginx.org\/download\/%{name}-%{version}.tar.gz\r\nSource1: logrotate\r\nSource2: nginx.init.in\r\nSource3: nginx.sysconf\r\nSource4: nginx.conf\r\nSource5: nginx.vh.default.conf\r\nSource7: nginx-debug.sysconf\r\nSource8: nginx.service\r\nSource9: nginx.upgrade.sh\r\nSource10: nginx.suse.logrotate\r\nSource11: nginx-debug.service\r\nSource12: COPYRIGHT\r\nSource13: nginx.check-reload.sh\r\n\r\nLicense: 2-clause BSD-like license\r\n\r\nBuildRoot: %{_tmppath}\/%{name}-%{main_version}-%{main_release}-root\r\nBuildRequires: zlib-devel\r\nBuildRequires: pcre-devel\r\n\r\nProvides: webserver\r\n\r\n%description\r\nnginx [engine x] is an HTTP and reverse proxy server, as well as\r\na mail proxy server.\r\n\r\n%if 0%{?suse_version} == 1315\r\n%debug_package\r\n%endif\r\n\r\n%prep\r\n%setup -q\r\ncp %{SOURCE2} .\r\nsed -e 's|%%DEFAULTSTART%%|2 3 4 5|g' -e 's|%%DEFAULTSTOP%%|0 1 6|g' \\\r\n    -e 's|%%PROVIDES%%|nginx|g' &lt; %{SOURCE2} &gt; nginx.init\r\nsed -e 's|%%DEFAULTSTART%%||g' -e 's|%%DEFAULTSTOP%%|0 1 2 3 4 5 6|g' \\\r\n    -e 's|%%PROVIDES%%|nginx-debug|g' &lt; %{SOURCE2} &gt; nginx-debug.init\r\n<span style=\"font-weight:bold;color:blue\">git clone https:\/\/github.com\/arut\/nginx-dav-ext-module.git<\/span>\r\n\r\n%build\r\n.\/configure %{BASE_CONFIGURE_ARGS} \\\r\n    --with-cc-opt=&quot;%{WITH_CC_OPT}&quot; \\\r\n    --with-ld-opt=&quot;%{WITH_LD_OPT}&quot; \\\r\n    --with-debug <span style=\"font-weight:bold;color:blue\">--with-openssl-opt=&quot;-fPIC&quot;<\/span>\r\nmake %{?_smp_mflags}\r\n%{__mv} %{bdir}\/objs\/nginx \\\r\n    %{bdir}\/objs\/nginx-debug\r\n.\/configure %{BASE_CONFIGURE_ARGS} \\\r\n    --with-cc-opt=&quot;%{WITH_CC_OPT}&quot; \\\r\n    --with-ld-opt=&quot;%{WITH_LD_OPT}&quot; <span style=\"font-weight:bold;color:blue\">--with-openssl-opt=&quot;-fPIC&quot;<\/span>\r\nmake %{?_smp_mflags}\r\n\r\n(\u4ee5\u4e0b\u7565)<\/pre>\n<h3>5. \u30d3\u30eb\u30c9\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>\u30d3\u30eb\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3002<br \/>\n<code>$ rpmbuild -ba rpmbuild\/SPECS\/nginx.spec<\/code><\/p>\n<p>\u51fa\u6765\u4e0a\u304c\u3063\u305f\u3089\u3001RPM\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<br \/>\n<code>$ sudo yum localinstall rpmbuild\/RPMS\/x86_64\/nginx-1.12.1-1.el7.centos.ngx.x86_64.rpm<\/code><\/p>\n<p>\u5c55\u958b\u3057\u305f openssl \u30bd\u30fc\u30b9\u3092\u6383\u9664\u3057\u3066\u304a\u304f\u3002<br \/>\n<code>$ rm -r \/tmp\/openssl-1.0.2l<\/code><\/p>\n<h3>6. \u8d77\u52d5<\/h3>\n<p>\u30c7\u30fc\u30e2\u30f3\u3092\u8d77\u52d5\u3059\u308b\u3002<br \/>\n<code>$ sudo systemctl enable nginx<br \/>\n$ sudo systemctl start nginx<\/code><\/p>\n<p>\u53c2\u8003URL:<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/?p=9612\">HTTP\/2\u5bfe\u5fdcnginx\u306erpm\u30d1\u30c3\u30b1\u30fc\u30b8\u4f5c\u6210\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u203b\u4ee5\u4e0b\u306fCentOS 7.3\u307e\u3067\u306e\u53e4\u3044\u5185\u5bb9\u3067\u3059\u3002CentOS 7.4 \u3067\u306f OpenSSL 1.0.2 \u304c\u6a19\u6e96\u3068\u306a\u3063\u305f\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u4f5c\u696d\u306f\u4e0d\u8981\u3067\u3059\u3002 CentOS7.3 \u306b\u542b\u307e\u308c\u308b\u6a19\u6e96\u30d1\u30c3\u30b1\u30fc\u30b8\u306e OpenSSL \u304c 1. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,13,14,7],"tags":[],"_links":{"self":[{"href":"https:\/\/fsck.jp\/index.php?rest_route=\/wp\/v2\/posts\/387"}],"collection":[{"href":"https:\/\/fsck.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fsck.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fsck.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fsck.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=387"}],"version-history":[{"count":0,"href":"https:\/\/fsck.jp\/index.php?rest_route=\/wp\/v2\/posts\/387\/revisions"}],"wp:attachment":[{"href":"https:\/\/fsck.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fsck.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fsck.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}