linux实训第三天--nginx源码包的安装及配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiangshangbashaonian/article/details/85230806

1.解压源码包

[root@localhost ~]# cd /home/iqiqiya/Desktop

[root@localhost Desktop]# tar -xf nginx-1.12.2.tar.gz

2.配置编译环境并进行编译安装

首先确保yum源已经配置好(yum本地源和网络源都可以)

[root@localhost Desktop]# yum -y install gcc make pcre-devel openssl-devel

[root@localhost nginx-1.12.2]# useradd nginx

[root@localhost nginx-1.12.2]# usermod -s "/sbin/nologin" nginx

[root@localhost Desktop]# cd nginx-1.12.2/

[root@localhost nginx-1.12.2]# ./configure --prefix=/usr/local/nginx --user=nginx

[root@localhost nginx-1.12.2]# make

[root@localhost 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'之类的错误

不用管

猜你喜欢

转载自blog.csdn.net/xiangshangbashaonian/article/details/85230806