Cara Compile dan Install Tengine Web Server di Ubuntu

Rabu, 17 Juli 2019

Cara Compile dan Install Tengine Web Server di Ubuntu - Tengine adalah server web yang dibuat oleh Taobao, situs web e-commerce terbesar di Asia. Berbasis pada server Nginx dan memiliki banyak fitur lanjutan. Tengine telah terbukti sangat stabil dan efisien di beberapa dari 100 situs web teratas di dunia, termasuk taobao.com dan tmall.com. Tengine telah menjadi proyek open source sejak Desember 2011. Saat ini sedang dikembangkan secara aktif oleh tim Tengine, yang anggota intinya berasal dari Taobao, Sogou dan perusahaan Internet lainnya. Tengine adalah upaya komunitas dan semua orang didorong untuk terlibat.


Fitur-fitur Tengine:
  • All features of Nginx-1.8.1 are inherited, i.e., it is compatible with Nginx.
  • Dynamic module loading support (DSO). You don't have to recompile Tengine when adding new modules to it.
  • HTTP/2 support. The ngx_http_v2_module supersedes the ngx_http_spdy_module module.
  • Sends unbuffered upload directly to HTTP and FastCGI backend servers, which saves disk I/Os.
  • More load balancing methods, e.g., consistent hashing, session persistence, upstream health check, and resolving upstream domain names on the fly.
  • Input body filter support. It's quite handy to write Web Application Firewalls using this mechanism.
  • Dynamic scripting language (Lua) support, which is very efficient and makes it easy to extend core functionalities.
Oke di tutorial ini saya akan membahas bagaimana cara instalasi Tengine di Ubuntu. Pertama, install beberapa beberapa paket yang dibutuhkan saat proses compile.
apt update && apt install libpcre++-dev libssl-dev zlib1g-dev git libssl-dev
Sekarang kita clone Tengine dari repo GitHub.
git clone https://github.com/alibaba/tengine
Sekarang waktunya compile:
mkdir /usr/local/nginx
mkdir /var/tmp/nginx
cd tengine
./configure --prefix=/usr/local/nginx \
--pid-path=/var/run/tengine.pid \
--error-log-path=/var/log/nginx/error.log \
--user=www-data \
--group=www-data \
--with-poll_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_concat_module \
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-client-body-temp-path=/var/tmp/nginx/client \
--with-ipv6 \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_sysguard_module
Log proses:
...................
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
+ jemalloc library is disabled
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/var/run/tengine.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "/var/tmp/nginx/client"
nginx dso module path: "/usr/local/nginx/modules/"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "/var/tmp/nginx/fastcgi"
nginx http uwsgi temporary files: "/var/tmp/nginx/uwsgi"
nginx http scgi temporary files: "/var/tmp/nginx/scgi"

Jika tidak ada error, kita lanjutkan.
make && make install
Log proses:
.....
'/usr/local/nginx/include'
test -f 'src/os/unix/ngx_thread.h' && cp 'src/os/unix/ngx_thread.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_socket.h' && cp 'src/os/unix/ngx_socket.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_os.h' && cp 'src/os/unix/ngx_os.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_user.h' && cp 'src/os/unix/ngx_user.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_pipe.h' && cp 'src/os/unix/ngx_pipe.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_sysinfo.h' && cp 'src/os/unix/ngx_sysinfo.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_process_cycle.h' && cp 'src/os/unix/ngx_process_cycle.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_linux_config.h' && cp 'src/os/unix/ngx_linux_config.h' '/usr/local/nginx/include'
test -f 'src/os/unix/ngx_linux.h' && cp 'src/os/unix/ngx_linux.h' '/usr/local/nginx/include'
test -f 'src/proc/ngx_proc.h' && cp 'src/proc/ngx_proc.h' '/usr/local/nginx/include'
test -f 'src/event/ngx_event_openssl.h' && cp 'src/event/ngx_event_openssl.h' '/usr/local/nginx/include'
test -f 'src/core/ngx_regex.h' && cp 'src/core/ngx_regex.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http.h' && cp 'src/http/ngx_http.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_request.h' && cp 'src/http/ngx_http_request.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_config.h' && cp 'src/http/ngx_http_config.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_core_module.h' && cp 'src/http/ngx_http_core_module.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_cache.h' && cp 'src/http/ngx_http_cache.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_variables.h' && cp 'src/http/ngx_http_variables.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_script.h' && cp 'src/http/ngx_http_script.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_upstream.h' && cp 'src/http/ngx_http_upstream.h' '/usr/local/nginx/include'
test -f 'src/http/ngx_http_upstream_round_robin.h' && cp 'src/http/ngx_http_upstream_round_robin.h' '/usr/local/nginx/include'
test -f 'src/http/modules/ngx_http_ssi_filter_module.h' && cp 'src/http/modules/ngx_http_ssi_filter_module.h' '/usr/local/nginx/include'
test -f 'src/http/v2/ngx_http_v2.h' && cp 'src/http/v2/ngx_http_v2.h' '/usr/local/nginx/include'
test -f 'src/http/v2/ngx_http_v2_module.h' && cp 'src/http/v2/ngx_http_v2_module.h' '/usr/local/nginx/include'
test -f 'src/http/modules/ngx_http_ssl_module.h' && cp 'src/http/modules/ngx_http_ssl_module.h' '/usr/local/nginx/include'
test -f 'src/http/modules/ngx_http_reqstat.h' && cp 'src/http/modules/ngx_http_reqstat.h' '/usr/local/nginx/include'
test -f 'objs/ngx_auto_headers.h' && cp 'objs/ngx_auto_headers.h' '/usr/local/nginx/include'
test -f 'objs/ngx_auto_config.h' && cp 'objs/ngx_auto_config.h' '/usr/local/nginx/include'
make[1]: Leaving directory '/root/tengine'

Sekarang Tengine sudah terinstall. Tinggal atur user dan hak akses direktori nya saja.
useradd -s /sbin/nologin www-data
cd /usr/local/nginx
chown www-data:www-data -R /usr/local/nginx/html
chown www-data:www-data -R /usr/local/nginx/logs
chown www-data:www-data -R /var/tmp/nginx
chmod 700 -R /usr/local/nginx/html
chmod 700 -R /var/tmp/nginx
chmod 777 -R /usr/local/nginx/logs
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
Sekarang kita jalankan Tengine webserver.
nginx -t
nginx -s start


root@linuxsec:~# curl -I localhost
HTTP/1.1 200 OK
Server: Tengine/2.2.2
Date: Tue, 30 Oct 2018 03:26:39 GMT
Content-Type: text/html
Content-Length: 555
Last-Modified: Tue, 30 Oct 2018 03:21:11 GMT
Connection: keep-alive
ETag: "5bd7ce27-22b"
Accept-Ranges: bytes

Untuk yang lain seperti pengaturan serverblock dll sama dengan Nginx karena web server ini memang berbasis Nginx. Oke sekian tutorial kali ini, jika ada yang ingin ditanyakan silahkan komentar.

Artikel Terkait Nginx ,Server ,Ubuntu