首页 > 代码库 > 源码安装H2O Http 服务端程序到Ubuntu服务器

源码安装H2O Http 服务端程序到Ubuntu服务器

首先安装全家桶

apt install -y build-essential zlib1g-dev libpcre3 libpcre3-dev unzip cmake libncurses5-dev libpam0g-dev bison libboost-dev libssl-dev openssl g++ libxml2-dev libcurl3-openssl-dev libpng-dev libpng12-dev libfreetype6-dev libfreetype6-dev

 

下载安装包:

curl https://github.com/h2o/h2o/archive/v2.2.2.tar.gz -o v2.2.2.tar.gz

 

解压:

 tar zxf v2.2.2.tar.gz

 

配置安装目录:

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/h2o -DWITH_BUNDLED_SSL=on

 

编译安装:

make -j8

make install

 

配置文件:

vim /home/etc/h2o.cf

  1 access-log: /tmp/h2o.log
  2 error-log: /tmp/h2o.err
  3 pid-file: /tmp/h2o.pid
  4 max-connections: 512
  5 file.send-gzip: ON
  6 tcp-fastopen: 3
  7 user: www
  8 file.index: [ ‘index.php‘, ‘index.html‘ ]
  9 file.mime.addtypes:
 10 text/html: .html .htm .shtml
 11 text/css: .css
 12 text/xml: .xml
 13 image/gif: .gif
 14 image/jpeg: .jpeg .jpg
 15 application/javascript: .js
 16 application/atom+xml: .atom
 17 application/rss+xml: .rss
 18 
 19 text/mathml: .mml
 20 text/plain: .txt
 21 text/vnd.sun.j2me.app-descriptor: .jad
 22 text/vnd.wap.wml: .wml
 23 text/x-component: .htc
 24 
 25 image/png: .png
 26 image/tiff: .tif .tiff
 27 image/vnd.wap.wbmp: .wbmp
 28 image/x-icon: .ico
 29 image/x-jng: .jng
 30 image/x-ms-bmp: .bmp
 31 image/svg+xml: .svg .svgz
 32 image/webp: .webp
 33 
 34 application/font-woff: .woff
 35 application/java-archive: .jar .war .ear
 36 application/json: .json
 37 application/mac-binhex40: .hqx
 38 application/msword: .doc
 39 application/pdf: .pdf
 40 application/postscript: .ps .eps .ai
 41 application/rtf: .rtf
 42 application/vnd.apple.mpegurl: .m3u8
 43 application/vnd.ms-excel: .xls
 44 application/vnd.ms-fontobject: .eot
 45 application/vnd.ms-powerpoint: .ppt
 46 application/vnd.wap.wmlc: .wmlc
 47 application/vnd.google-earth.kml+xml: .kml
 48 application/vnd.google-earth.kmz: .kmz
 49 application/x-7z-compressed: .7z
 50 application/x-cocoa: .cco
 51 application/x-java-archive-diff: .jardiff
 52 application/x-java-jnlp-file: .jnlp
 53 application/x-makeself: .run
 54 application/x-perl: .pl .pm
 55 application/x-pilot: .prc .pdb
 56 application/x-rar-compressed: .rar
 57 application/x-redhat-package-manager: .rpm
 58 application/x-sea: .sea
 59 application/x-shockwave-flash: .swf
 60 application/x-stuffit: .sit
 61 application/x-tcl: .tcl .tk
 62 application/x-x509-ca-cert: .der .pem .crt
 63 application/x-xpinstall: .xpi
 64 application/xhtml+xml: .xhtml
 65 application/xspf+xml: .xspf
 66 application/zip: .zip
 67 
 68 application/octet-stream: .bin .exe .dll
 69 application/octet-stream: .deb
 70 application/octet-stream: .dmg
 71 application/octet-stream: .iso .img
 72 application/octet-stream: .msi .msp .msm
 73 
 74 application/vnd.openxmlformats-officedocument.wordprocessingml.document: .docx
 75 application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: .xlsx
 76 application/vnd.openxmlformats-officedocument.presentationml.presentation: .pptx
 77 
 78 audio/midi: .mid .midi .kar
 79 audio/mpeg: .mp3
 80 audio/ogg: .ogg
 81 audio/x-m4a: .m4a
 82 audio/x-realaudio: .ra
 83 
 84 video/3gpp: .3gpp .3gp
 85 video/mp2t: .ts
 86 video/mp4: .mp4
 87 video/mpeg: .mpeg .mpg
 88 video/quicktime: .mov
 89 video/webm: .webm
 90 video/x-flv: .flv
 91 video/x-m4v: .m4v
 92 video/x-mng: .mng
 93 video/x-ms-asf: .asx .asf
 94 video/x-ms-wmv: .wmv
 95 video/x-msvideo: .avi
 96 
 97 hosts:
 98 "域名:端口":
 99 #header.add: "strict-transport-security: max-age=39420000; includesubdomains; preload"
100 header.add: "X-Frame-Options: SAMEORIGIN"
101 header.add: "X-Content-Type-Options: nosniff"
102 header.add: "X-XSS-Protection: 1; mode=block"
103 listen:
104 port: 端口
105 #ssl:
106 #certificate-file: /home/wwwroot/ssl/miraisann.com.crt
107 #key-file: /home/wwwroot/ssl/miraisann.com.key
108 #dh-file: /home/wwwroot/ssl/dhparam4096.pem
109 #minimum-version: TLSv1.1
110 #cipher-preference: server
111 #cipher-suite: CHACHA20 EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4
112 paths:
113 /:
114 file.dir: /home/wwwroot/domain/xx.com
115 redirect:
116 url: /index.php/
117 internal: YES
118 status: 307
119 file.custom-handler:
120 extension: .php
121 fastcgi.connect:
122 port: /tmp/php-fpm.sock
123 type: unix

 

源码安装H2O Http 服务端程序到Ubuntu服务器