安装教程目录所需

Linux环境下安装nginx教程

服务器技术 2021-12-27 12:39:38 24

导读

目录 1、安装所需环境 //安装gcc yuminstallgcc-c++ //安装PCREpcre-devel yuminstall-ypcrepcre-devel //安装zlib yuminstall-yzlibzlib-devel //安装OpenSSL yuminstall-yopensslopenssl-devel 2、创建nginx目录并下载安装包 //进入usr/local目录 cd……
目录

1、安装所需环境

//安装gcc
yum install gcc-c++

//安装PCRE pcre-devel
yum install -y pcre pcre-devel

//安装zlib
yum install -y zlib zlib-devel

//安装Open SSL
yum install -y openssl openssl-devel

2、创建nginx目录并下载安装包

//进入usr/local目录
cd /usr/local

//创建nginx目录
mkdir nginx

//进入nginx目录
cd nginx

//下载tar包
wget http://nginx.org/download/nginx-1.13.7.tar.gz

//解压tar
tar -xvf nginx-1.13.7.tar.gz

3、安装nginx

//进入nginx目录
cd /usr/local/nginx/nginx-1.13.7

//执行命令
./configure

//执行make命令(要是执行不成功请检查最开始安装的四个有没有安装成功)
make

//执行make install命令
make install

4、启动nginx

//进入/usr/local/nginx/sbin目录,输入./nginx即可启动nginx
./nginx

//关闭nginx
./nginx -s quit  或者 ./nginx -s stop

//重启nginx
./nginx -s reload

//查看nginx进程
ps -ef|grep nginx

5、设置开启自启动

//编辑
vim /etc/rc.local

//最底部增加这一行
/usr/local/nginx/sbin/nginx
1253067 TFnetwork_cn