Home > Article > Computer Tutorials > Tutorial on compiling and installing Nginx1.22 on Centos8 stream system.
The tutorial for compiling and installing Nginx 1.22 CentOS 8 Stream system is as follows:
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
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
Unzip the source code package:
tar -zxvf nginx-1.22.0.tar.gz
Enter the decompressed directory:
cd nginx-1.22.0
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.
Compile and install Nginx:
makesudo make install
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!