Nginx 安装
1.安装Nginx
wget -c https://nginx.org/download/nginx-1.51.9.tar.gz
2.解压安装包
tar -zxvf nginx-1.51.9.tar.gz
3.nginx的配置(推荐使用默认配置)
./configure
//以下命令要先进入 cd nginx-1.11.6
4.安装gcc 环境
yum install gcc-c++
5.安装PCRE依赖库
yum install -y pcre pcre-devel
6.安装zlib 依赖库
yum install -y zlib zlib-devel
7.安装OpenSSL安全套接字层密码库
yum install -y openssl openssl-devel
8.再次执行配置命令
./configure
9.编译安装
make install
10.查找安装路径命令
whereis nginx
11. 修改端口号(注意要先开放对应端口)
cd /usr/local/nginx/conf (进入目录)
cp nginx.conf nginx.conf.back (备份)
vi nginx.conf (编辑nginx.conf配置文件)
12.重新启动
cd /usr/local/nginx/sbin
./nginx -s reload
13.查询nginx进程
ps aux|grep nginx
附:
(1)重启 nginx(cd /usr/local/nginx/sbin)
./nginx -s quit
./nginx
(2)重新加载配置文件
./nginx -s reload