Compile nginx with http ssl module for Openwrt/Lede

最近需要用到 Openwrt/Lede 下的 nginx,opkg install nginx 安装的包并不支持 https 和 http2,需要自己编译,尝试用英文记录:

Install nginx adopt this command in openwrt:

opkg install nginx

But this nginx version without http_ssl_module,that means it does not support HTTPS.

Cross-compile nginx:


Do everything as non-root user!
Don’t compile in Linux Subsystem on Windows 10
1-4 GB of RAM to build Openwrt

  1. Install build tools to do the cross-compilation process

    apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev subversion libncurses5-dev gcc-multilib flex gettext  mercurial
  1. Download the OpenWrt source code

    git clone
  2. Setup the Build System,select your router types like this

    cd openwrt  
    make menuconfig  

    make V=s

    make V=s may spend half an hour…

  3. Compile nginx ipk

    scripts/feeds update
    scripts/feeds search nginx
    scripts/feeds install nginx
    make menuconfig
            Web Servers/Proxies
                nginx : select M
                   nginx: ENTER
                        Enable SSL module : Y
                        save & exit
    time make -j5

    If you want to deploy HTTP2, choose Enable http_v2_module at the sametime.
    Compile peocess may spend 10 minutes.

  4. Then search nginx ipk file,copy it to router and install

    find . -type f -name nginx\*ipk

    You can use the “ssl on” directive in /etc/nginx/nginx.conf.