1,安装nginx依赖
yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
如图:
centos下编译安装nginx
安装成功:
centos下编译安装nginx

2,下载nginx-1.17.1.tar.gz,上传至/usr/local/src目录下
下载地址:https://nginx.org/download/

#进入目录
cd /usr/local/src
#解压文件
tar -zxvf nginx-1.17.1.tar.gz
##进入nginx目录
cd nginx-1.17.1
## 配置
./configure --prefix=/usr/local/nginx

# make
make
make install
#查看是否安装成功
cd /usr/local/nginx/sbin
./nginx -t

如图:成功
centos下编译安装nginx

3,启动nginx
命令:./nginx
查看:ps -ef | grep nginx
启动成功如图:
centos下编译安装nginx

4,通过ip访问如图表示成功了:
centos下编译安装nginx

5,设置开机自启动
vim /etc/rc.d/rc.local
添加一行/usr/local/nginx/sbin/nginx
centos下编译安装nginx

参考至:https://www.cnblogs.com/xxoome/p/5866475.html

相关文章:

  • 2022-01-08
  • 2021-06-30
  • 2022-01-29
  • 2021-11-03
  • 2021-04-09
  • 2021-10-27
  • 2022-01-25
  • 2022-02-07
猜你喜欢
  • 2021-08-06
  • 2019-05-20
  • 2021-05-24
  • 2022-01-09
  • 2021-04-14
  • 2021-08-06
  • 2022-12-23
相关资源
相似解决方案