Compile and install Nginx 1.22 tutorial on Ubuntu 18.04 system.

The following is a tutorial for compiling and installing Nginx 1.22 on Ubuntu 18.04 system:

  1. Update system packages:

    sudo apt update
    sudo apt upgrade
    
  2. Install dependencies required for compilation:

    sudo apt install build-essential curl zlib1g-dev libpcre3-dev libssl-dev libffi-dev
    
  3. Download the Nginx source code:

    mkdir ~/nginx
    cd ~/nginx
    curl -O https://nginx.org/download/nginx-1.22.0.tar.gz
    tar -zxvf nginx-1.22.0.tar.gz
    cd nginx-1.22.0
    
  4. Configure compilation parameters:

    ./configure --prefix=/usr/local/nginx --with-http_ssl_module
    
  5. Compile and install Nginx:

    make
    sudo make install
    
  6. Start Nginx:

    sudo /usr/local/nginx/sbin/nginx
    

You have now successfully compiled and installed Nginx 1.22 on Ubuntu 18.04. You can verify that Nginx is running properly by visiting your server's IP address in your browser. Please make sure to configure and adjust properly according to your needs in practice.

Please note that Nginx installed by compiling and installing will not be automatically updated, you need to manually update the version or perform maintenance.

Guess you like

Origin blog.csdn.net/tiansyun/article/details/131148244