5分钟学会在CentOS上安装Nginx

103 阅读1分钟

1. 安装依赖

1.1 安装gcc

yum -y install gcc

1.2 安装pcre

yum install -y pcre pcre-devel

1.3 安装zlib

yum install -y zlib zlib-devel

1.4 安装openssl

yum install -y openssl openssl-devel

2. 下载文件

Nginx官网下载页 nginx.org/en/download…

cd /usr/src

wget http://nginx.org/download/nginx-1.12.2.tar.gz

tar -zxvf nginx-1.12.2.tar.gz

cd nginx-1.12.2

3. 安装

3.1 ./configure 命令检查是否正确

./configure --with-http_ssl_module

3.2 执行安装操作

make && make install

4. 运行

cd /usr/local/nginx/sbin

4.1 启动nginx

./nginx

5. 修改配置

5.1 修改

vi /usr/local/nginx/conf

5.2 检查

./nginx -t

5.3 重载

./nginx -s reload