Install Method 1: Use repo file to install nginx
No. | Steps | Commands |
---|---|---|
1 | Configure nginx repo file | #vim /etc/yum.repos.d/nginx.repo add below content into this repo and rename epel.repo if have repo file====> [nginx-stable] [nginx-mainline] |
2 | Clean yum cache | #yum clean all #yum makecache |
3 | Install nginx | #yum install nginx -y |
4 | Check version t0 verify install successfully | #nginx -v |
5 | Start nginx service | #systemctl start nginx |
6 | Check nginx service status | #systemctl status nginx configuration under /etc/<nginx service>/conf.d should be included in NGINX configuration |
Install Method 2: Use package to install nginx
No. | Steps | Commands |
---|---|---|
1 | Install related dependencies | #yum install gc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel |
2 | Download latest nginx package | #wget http://nginx.org/download/nginx-1.21.6.tar.gz |
3 | Uncompressed the package | #tar -zxvf nginx-1.21.6.tar.gz |
4 | Configure nginx | #cd nginx-1.21.6/ # --with-http_ssl_module # 配置HTTPS时使用 |
5 | Compile and Install | make && make install |
6 | Add niginx into PATH | #vi /etc/profile #add below line
|
7 | Add into system management | #vi /usr/lib/systemd/system/nginx.service [Unit] [Service] [Install] |
8 | Re-load system service and start nginx | #systemctl daemon-reload #systemctl start nginx |
9 | Check nginx service status | #systemctl status nginx configuration under /etc/<nginx service>/conf.d should be included in NGINX configuration |
client_max_body_size 5G;
client_header_timeout 600s;
client_body_timeout 600s;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
For method 1, If the following error occurs, please replace $releasever to the host os-release version. eg. The host OS is rhel7.9, change the $releasever to 7 in the yum repo file nginx.repo