一、nginx源码安装
1、安装依赖包
yum install -y pcre-devel zlib-devel openssl-devel wget gcc tree vim
2、下载源码包
wget http://nginx.org/download/nginx-1.12.2.tar.gz
3、安装
[root@localhost ~]# cd nginx/
[root@localhost nginx]#./configure --prefix=/usr/local/nginx
[root@localhost nginx]#make && make install
4、配置在用户目录下配置.bash_profile文件,或者配置全局的/etc/profile文件
export PATH=$PATH:/usr/local/nginx/sbin
5、使得配置的文件生效
[root@localhost ~]# source ./.bash_profile
6、启动nginx与停止
[root@localhost ~]# nginx
[root@localhost ~]# nginx -s stop