Linux的CentOS7 64位安裝nginx
步驟1:確認基礎環境
在安裝nginx前首先要確認系統中安裝了gcc、pcre-devel、zlib-devel、openssl-devel。
安裝命令:
yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
步驟2.安裝nginx
解壓下載的安裝包
下載地址:https://nginx.org/download/
解壓:tar -zxvf ./nginx-1.17.8.tar.gz
進入nginx目錄:cd nginx-1.17.8
如果報錯缺少這個包,也要安裝:yum install glibc-devel
配置:./configure --with-http_ssl_module --prefix=/software/nginx --with-http_stub_status_module --with-openssl=/software/tools/openssl1.1.1j
步驟3:可以進行make
make
步驟4:可以進行make install
make install
步驟5:修改環境變數
vi /etc/profile
PATH=$PATH:/nginx/sbin
export PATH
source /etc/profile
步驟6非root安裝要把nginx的啟動命令授權
chown root:root nginx
chmod 755 nginx
chmod u+s nginx
步驟7 配置nginx.config,新增下面的命令用指定使用者
user weblogic;
步驟8啟動nginx
cd /software/nginx/sbin
啟動
./nginx
停止
./nginx -s stop
.檢視是否啟動成功
ps -ef | grep nginx