Cnit09

Cnit09

2023-09-23 21:00:18

Combine Nginx from Source on Linux

Hiện tại có Nginx có nhiều version nên ở topic này chúng ta sẽ cài đặt version Nginx 1.24.0 Truy cập trang web chính thức của Nginx để tìm phiên bản mới nhất và lấy đường dẫn tới file mã nguồn tar.gz.

Chuẩn bị các lib cần dùng:

yum group install "Development Tools" -y

yum install pcre-devel.x86_64 gd gd-devel.x86_64 zlib-devel.x86_64 -y

#module ssl nginx
wget "https://ftp.openssl.org/source/openssl-1.1.1n.tar.gz" --no-check-certificate

Bước 1: Tải mã nguồn Nginx

#wget http://nginx.org/download/nginx-.tar.gz
wget http://nginx.org/download/nginx-1.24.0.tar.gz

Bước 2: Cấu hình và cài đặt Nginx

tar -xzvf nginx-1.24.0.tar.gz
cd nginx-1.24.0

# cấu hình cơ bản của nginx và được cài ở folder opt
./configure \
--prefix=/opt/nginx-1.24.0 \
--with-threads \
--with-stream \
--with-http_mp4_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_image_filter_module \
--with-http_auth_request_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_slice_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--with-openssl=/root/openssl-1.1.1n

make
make install

Bước 3: Kiểm tra cài đặt

/opt/nginx-1.24.0/sbin/nginx -V

Bước 4: Khởi động Nginx

/opt/nginx-1.24.0/sbin/nginx -c /opt/nginx-1.24.0/conf/nginx.conf

Bước 5: Truy cập vào web server Nginx tại http://localhost hoặc địa chỉ IP của máy chủ. Kết quả như hình.

Combine Nginx from Source on Linux
0 Likes0 Comments