{"id":289,"date":"2016-12-18T21:36:24","date_gmt":"2016-12-18T13:36:24","guid":{"rendered":"https:\/\/blog.freesilo.com\/?p=289"},"modified":"2016-12-18T21:36:24","modified_gmt":"2016-12-18T13:36:24","slug":"apache2-%e4%b9%8b-%e5%bc%80%e5%90%afhttp2","status":"publish","type":"post","link":"https:\/\/freesilo.com\/?p=289","title":{"rendered":"Apache2 \u4e4b \u5f00\u542fHTTP\/2"},"content":{"rendered":"<p><a href=\"https:\/\/httpd.apache.org\/\">Apache HTTP Server<\/a> <a href=\"http:\/\/www.apache.org\/dist\/httpd\/CHANGES_2.4.17\">2.4.17<\/a> \u52a0\u5165\u4e86HTTP\/2\u6a21\u5757<a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_http2.html\">mod_http2<\/a>\uff0c\u770b\u5230Debian sid\u6e90\u5df2\u7ecf\u66f4\u65b0\u4e86\uff0c\u5c31\u5728VPS\u4e0a\u4e5f\u5347\u7ea7\u4e86\u4e00\u4e0b\u3002<\/p>\n<p><a href=\"https:\/\/tracker.debian.org\/pkg\/apache2\">\u76ee\u524dDebian\u5404\u7248\u672c\u7684httpd\u7248\u672c\u53f7<\/a><\/p>\n<p>\u4fee\u6539\u6e90<\/p>\n<pre>nano \/etc\/apt\/sources.list<\/pre>\n<p>\u52a0\u5165\u4e00\u884c<\/p>\n<pre>deb http:\/\/ftp.debian.org\/debian\/ testing main contrib non-free<\/pre>\n<p>\u5347\u7ea7Apache2<\/p>\n<pre>apt-get update\r\napt-get install apache2<\/pre>\n<p>\u542f\u7528mod_http2<\/p>\n<pre>a2enmod http2<\/pre>\n<p>\/etc\/apache2\/sites-available\/cnlic80.conf\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;VirtualHost *:80&gt;\r\n\tServerAdmin webmaster@localhost\r\n\tDocumentRoot \/var\/www\/html\r\n\r\n\tErrorLog ${APACHE_LOG_DIR}\/error.log\r\n\tCustomLog ${APACHE_LOG_DIR}\/access.log combined\r\n\r\n\tProtocols h2c http\/1.1\r\n\tProtocolsHonorOrder On\r\n\r\n\t&lt;IfModule mod_rewrite.c&gt;\r\n\t  RewriteEngine On\r\n\t  RewriteCond %{HTTPS} off\r\n\t  RewriteRule (.*) https:\/\/%{HTTP_HOST}%{REQUEST_URI}\r\n\t&lt;\/IfModule&gt;\r\n&lt;\/VirtualHost&gt;<\/pre>\n<p>\/etc\/apache2\/sites-available\/cnlic443.conf\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;IfModule mod_ssl.c&gt;\r\n\tSSLStaplingCache shmcb:\/var\/run\/ocsp(128000)\r\n\t&lt;VirtualHost *:443&gt;\r\n\t\tServerAdmin webmaster@localhost\r\n\t\tDocumentRoot \/var\/www\/html\r\n\r\n\t\tErrorLog ${APACHE_LOG_DIR}\/error.log\r\n\t\tCustomLog ${APACHE_LOG_DIR}\/access.log combined\r\n\r\n\t\tHeader always set Strict-Transport-Security \"max-age=63072000; includeSubdomains; preload\"\r\n\t\tHeader always set Public-Key-Pins \"pin-sha256=\\\"MijrRMqLamJ5JIdQY2z07\/U4iRdUqTxu5ei8+FfSKnE=\\\"; pin-sha256=\\\"b5EjL7NMkpmKiO8Q5gXMahNdgjbPIxA1u7fYkhMAWLk=\\\"; max-age=86400; includeSubDomains\"\r\n\r\n\t\tProtocols h2 http\/1.1\r\n\t\tProtocolsHonorOrder On\r\n\r\n\t\tSSLEngine On\r\n\t\tSSLProtocol all -SSLv2 -SSLv3\r\n\t\tSSLCertificateFile\t\/etc\/apache2\/ssl\/cnlic_com.crt\r\n\t\tSSLCertificateKeyFile\t\/etc\/apache2\/ssl\/cnlic_com.key\r\n\t\tSSLHonorCipherOrder On\r\n\t\tSSLCipherSuite \"ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-RSA-AES256-SHA ECDHE-RSA-AES128-SHA DHE-RSA-AES256-SHA DHE-RSA-AES128-SHA DES-CBC3-SHA\"\r\n\r\n\t\tSSLUseStapling On\r\n\t\tSSLStaplingResponderTimeout 5\r\n\t\tSSLStaplingReturnResponderErrors Off\r\n\t&lt;\/VirtualHost&gt;\r\n&lt;\/IfModule&gt;<\/pre>\n<p>\u91cd\u542fapache2<\/p>\n<pre>service apache2 restart<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Apache HTTP Server 2.4.17 \u52a0\u5165\u4e86HTTP\/2\u6a21\u5757mod&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/freesilo.com\/?p=289\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-apache"],"_links":{"self":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=289"}],"version-history":[{"count":1,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}