Home  >  Article  >  Computer Tutorials  >  Tutorial on compiling and installing Nginx1.22 on Centos8 stream system.

Tutorial on compiling and installing Nginx1.22 on Centos8 stream system.

王林
王林forward
2024-02-19 14:45:231179browse

Centos8 stream系统编译安装Nginx1.22教程。

The tutorial for compiling and installing Nginx 1.22 CentOS 8 Stream system is as follows:

  1. First, make sure your CentOS 8 Stream system has the necessary development tools and dependencies installed. You can install them using the following command:

    sudo dnf groupinstall "Development Tools"sudo dnf install pcre-devel zlib-devel openssl-devel
  2. Download the source code package of Nginx 1.22. You can visit the official website of Nginx (

    ) or use the following command to download:

    wget 
  3. Unzip the source code package:

    tar -zxvf nginx-1.22.0.tar.gz
  4. Enter the decompressed directory:

    cd nginx-1.22.0
  5. Configure compilation parameters. Here is a basic example:

    ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module

    Other modules can be added or removed according to your needs. Make sure your parameters meet your specific requirements.

  6. Compile and install Nginx:

    makesudo make install
  7. After the installation is complete, you can start the Nginx service:

    sudo /usr/local/nginx/sbin/nginx

    Alternatively, you can add Nginx as a system service so that it starts automatically when the system starts:

    sudo vi /etc/systemd/system/nginx.service

    Add the following content to the file:

    [Unit]Description=nginxAfter=network.target[Service]ExecStart=/usr/local/nginx/sbin/nginxExecReload=/usr/local/nginx/sbin/nginx -s reloadExecStop=/usr/local/nginx/sbin/nginx -s stop[Install]WantedBy=multi-user.target

    Save and close the file. Then run the following command to enable the Nginx service:

    sudo systemctl enable nginx

    You can now use
    sudo systemctl start nginx to start the Nginx service.

The above is a basic tutorial for compiling and installing Nginx 1.22 on CentOS 8 Stream system. Please note that the specific configuration and parameters may vary according to your needs, and you can adjust them according to your own situation. Also, make sure to back up important files and configurations before performing any operations.

The above is the detailed content of Tutorial on compiling and installing Nginx1.22 on Centos8 stream system.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete