Linux安装Nginx详细步骤

文章目录

本期教程分享在Linux上安装 Nginx。

本教程中Linux版本为RedHat6.5,Nginx版本为1.13.12,教程中使用到的安装包和依赖都放到网盘了,在公众号【IT学长】回复关键词nginx安装包自行下载。

1、服务器上传安装包以及依赖文件:

linux_dependencies_rpm

pcre-8.10.tar.gz

openssl-1.0.1e.tar.gz

zlib-1.2.5.zip

nginx-1.13.12.tar.gz

powershell 复制代码
cd /root

#新建 nginx 目录,用于存放安装包和其它依赖文件
mkdir nginx

上传安装包和依赖文件到 /root/nginx 目录下
2、安装依赖rpm
powershell 复制代码
cd  /root/nginx/linux_dependencies_rpm

rpm -ivh --force --nodeps *.rpm
3、安装pcre
powershell 复制代码
cd /root/nginx

tar -zxvf pcre-8.10.tar.gz

cd pcre-8.10

./configure --prefix=/usr/local/pcre

make

make install
4、安装openssl
powershell 复制代码
cd /root/nginx

tar -zxvf openssl-1.0.1e.tar.gz

cd openssl-1.0.1e

./config --prefix=/usr/local/openssl 

make

make install  #如果有报错可以忽略
5、安装zlib
powershell 复制代码
cd /root/nginx

unzip zlib-1.2.5.zip

cd zlib-1.2.5

chmod +x configure

./configure --prefix=/usr/local/zlib

make

make install
6、安装nginx
powershell 复制代码
cd /root/nginx

tar -zxvf nginx-1.13.12.tar.gz

mv nginx-1.13.12 nginx

cd nginx

./configure 

--prefix=/usr/local/nginx 

--with-http_stub_status_module 

--with-http_ssl_module 

--with-http_sub_module 

--without-http_limit_req_module

--without-http_mirror_module

--with-pcre=/root/nginx/pcre-8.10 

--with-openssl=/root/nginx/openssl-1.0.1e 

--with-zlib=/root/nginx/zlib-1.2.5 

--with-stream

make

make install

#启动nginx:

cd /usr/local/nginx

cd sbin

./nginx

ps -ef | grep nginx

本期教程就分享到这里,关注【IT学长】跟着学长学IT!

相关推荐
搬码临时工7 分钟前
如何把本地服务器变成公网服务器?内网ip网址转换到外网连接访问
运维·服务器·网络·tcp/ip·智能路由器·远程工作·访问公司内网
vortex511 分钟前
探索 Shell:选择适合你的命令行利器 bash, zsh, fish, dash, sh...
linux·开发语言·bash·shell·dash
GalaxyPokemon36 分钟前
LeetCode - 148. 排序链表
linux·算法·leetcode
Guheyunyi1 小时前
监测预警系统重塑隧道安全新范式
大数据·运维·人工智能·科技·安全
懒羊羊大王呀1 小时前
Ubuntu20.04中 Redis 的安装和配置
linux·redis
鳄鱼杆1 小时前
服务器 | Centos 9 系统中,如何部署SpringBoot后端项目?
服务器·spring boot·centos
杰哥技术分享1 小时前
在 CentOS 上安装 Docker 和 Docker Compose 并配置使用国内镜像源
linux·docker·centos
知更鸟呆呆1 小时前
【Linux操作系统】基础开发工具(yum、vim、gcc/g++)
linux·运维·vim
xiangyong581 小时前
ubuntu系统文件误删(/lib/x86_64-linux-gnu/libc.so.6)修复方案 [成功解决]
linux·ubuntu·gnu
Gold Steps.2 小时前
Docker容器部署elasticsearch8.*与Kibana8.*版本使用filebeat采集日志
运维·docker·云原生·es