1. 程式人生 > >linux實訓第三天--nginx原始碼包的安裝及配置

linux實訓第三天--nginx原始碼包的安裝及配置

1.解壓原始碼包

[[email protected] ~]# cd /home/iqiqiya/Desktop

[[email protected] Desktop]# tar -xf nginx-1.12.2.tar.gz

2.配置編譯環境並進行編譯安裝

首先確保yum源已經配置好(yum本地源和網路源都可以)

[[email protected] Desktop]# yum -y install gcc make pcre-devel openssl-devel

[[email protected] nginx-1.12.2]# useradd nginx

[[email protected] nginx-1.12.2]# usermod -s "/sbin/nologin" nginx

[[email protected] Desktop]# cd nginx-1.12.2/

[[email protected] nginx-1.12.2]# ./configure --prefix=/usr/local/nginx --user=nginx

[[email protected] nginx-1.12.2]# make

[[email protected] nginx-1.12.2]# make install

即可成功安裝至/usr/local/nginx

3.啟動與關閉

/usr/local/nginx/sbin/nginx

/usr/local/nginx/sbin/nginx -s stop

4.檢視是否啟動成功

ss -anuptl | grep :80

注意:

如果出現make[1]: Leaving directory `/home/iqiqiya/Desktop/nginx-1.12.2'之類的錯誤

不用管