Skip to content

Nginx

Giới thiệu và license

Nginx là web server và reverse proxy hiệu năng cao, kiến trúc master/worker với event loop. Trên thiết bị nhúng thường dùng khi cần reverse proxy cho nhiều service hoặc phục vụ nhiều kết nối đồng thời. License: BSD-2-Clause.

Kích thước và tài nguyên sử dụng

Build / cross-compile

Yocto

Recipe nằm trong layer meta-openembedded/meta-webserver:

# bblayers.conf: thêm meta-openembedded/meta-webserver
IMAGE_INSTALL:append = " nginx"

Petalinux

Buildroot

BR2_PACKAGE_NGINX=y
BR2_PACKAGE_NGINX_HTTP=y
BR2_PACKAGE_NGINX_HTTP_SSL_MODULE=y

Cấu hình mẫu

worker_processes 1;

events {
    worker_connections 64;
}

http {
    server {
        listen 80;
        root /www;
        autoindex off;

        location /api/ {
            proxy_pass http://127.0.0.1:8080/;
        }
    }
}

Kiểm tra cấu hình:

nginx -t

Tích hợp

Reverse proxy / FastCGI

HTTPS

Debug và tuning

Tài liệu tham khảo