CentOS7安装nginx

1.解压安装包

tar -xvf nginx-1.10.0.tar.gz

2.进入nginx-1.10.0配置

# 在nginx目录下执行./configure配置
./configure

(1)安装gcc

# 权限不足要用管理员安装
yun install gcc

重新配置报新错

(2)安装pcre-devel

yum -y install pcre-devel

重新配置报错

(3)安装zlib

yum install -y zlib zlib-devel

(4)安装openssl openssl-devel

yum -y install openssl openssl-devel

再次配置

成功!

3. 安装

sudo make install

4.找到nginx

whereis nginx

5.启动和停止


进入sbin目录

# 开启
./nginx
# 停止
./nginx -s stop # 此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程。
./nginx -s quit # 此方式停止步骤是待nginx进程处理任务完毕进行停止。
# 重新加载
./nginx -s reload

6. 配置文件

cd /usr/local/nginx/conf

(0)备份

cp nginx.conf nginx.conf.back

(1)编辑

vi nginx.conf

启动即可

heroes never die!
原文地址:https://www.cnblogs.com/daiSir/p/14330878.html