-
use root role login the server
-
cd to usr/local folder
-
run
wget http://nginx.org/download/nginx-1.18.0.tar.gzto download nginx -
run
tar -xvzf nginx-1.18.0.tar.gzto unzip -
nginx depend on PCRE and zlib, hence we need to run
yum -y install pcre pcre-develto install pcre. runyum install -y zlib-develto install zlib or runyum -y install make zlib-devel gcc gcc-c++ libtool openssl openssl-develto install make, zlib-devel, gcc, gcc-c++, openssl, openssl-devel, libtool. -
cdtousr/local/nginx-1.18.0run./configure, you will see the nginx path informations like ( nginx binary file:/usr/local/nginx/sbin/nginx) -
stay at
usr/local/nginx-1.18.0runmake && make installto compile and then nginx folder will be created atusr/local/ -
cd to
/usr/local/nginx/sbin/nginxrun./nginx -
cd to
/usr/local/nginx/confwe can edit nginx.conf file -
remember to
安全组规则add your port -
run
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/to make nginx gloabl, then you can run nginx command everywhere. -
check nginx config in linux