Chuyện của sys

DevOps Blog

Hướng dẫn compile Nginx từ source trên Centos July 14, 2017


Nginx là gì?

NGINX (Pronounced as Engine-X) is an open source, lightweight, high-performance web server or proxy server. Nginx used as reverse proxy server for HTTP, HTTPS, SMTP, IMAP, POP3 protocols, on the other hand, it is also used for servers load balancing and HTTP Cache. Nginx accelerates content and application delivery, improves security, facilitates availability and scalability for the busiest websites on the Internet.

Trong bài viết này mình không đi sâu về khái niệm cũng như chi tiết của nginx, vì ngoài là 1 phần mễm mã nguồn mở thì bên trong nó là cả 1 đại dương rộng lớn về ngôn ngữ, cấu hình, cách hoạt động, tính năng, hiệu suất… mà chỉ để cập tới việc cài đặt nó, nhưng không dùng cách thông thường là cài đặt từ yum mà là complile từ source.

Compile Nginx from source with SSL support

  • Install dependencies

yum install pcre pcre-devel zlib zlib-devel
wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
tar -xvzf openssl-1.1.0e.tar.gz
cd openssl-1.1.0e/
./config –openssldir=/usr/local/ssl
make
make install
openssl version

  • Compile nginx to custom location

wget http://nginx.org/download/nginx-1.12.0.tar.gz
tar -xvzf nginx-1.12.0.tar.gz
cd nginx-1.12.0
./configure –prefix=/zserver/nginx –with-http_gzip_static_module –with-http_stub_status_module –with-http_ssl_module –with-openssl=/path/to/openssl-1.1.0e
make
make install
/zserver/nginx/sbin/nginx -V
nginx version: nginx/1.12.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
built with OpenSSL 1.1.0e 16 Feb 2017
TLS SNI support enabled
configure arguments: –prefix=/zserver/nginx –with-http_gzip_static_module –with-http_stub_status_module –with-http_ssl_module –with-openssl=/root/sources/openssl-1.1.0e

  • More information

http://nginx.org/en/docs/configure.html

Categories: Tài liệu

Leave a Reply

Your email address will not be published. Required fields are marked *