Nginx安装

Nginx安装

安装必须依赖

powershell 复制代码
yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

PCRE安装

下载依赖文件

http 复制代码
下载 PCRE 安装包,下载地址: http://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz

解压文件

powershell 复制代码
[root@ebs-135816 opt]# tar -zxvf pcre-8.45.tar.gz 

编译

powershell 复制代码
[root@ebs-135816 pcre-8.45]# ./configure 
[root@ebs-135816 pcre-8.45]# make 
[root@ebs-135816 pcre-8.45]# sudo make install

查看版本

powershell 复制代码
[root@ebs-135816 nginx-1.22.1]# pcre-config --version
8.45
[root@ebs-135816 nginx-1.22.1]# 

Nginx安装

第二步:

下载nginx http://nginx.org/download/nginx-1.6.2.tar.gz

解压

powershell 复制代码
[root@ebs-135816 home]# tar -zxvf nginx-1.22.1.tar.gz 

编译

powershell 复制代码
[root@ebs-135816 home]# cd nginx-1.22.1/
[root@ebs-135816 nginx-1.22.1]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
[root@ebs-135816 nginx-1.22.1]# ./configure --prefix=/home/nginx-1.22.1 --with-http_stub_status_module --with-http_ssl_module --with-pcre=/opt/pcre-8.45
powershell 复制代码
[root@ebs-135816 nginx-1.22.1]# make 

验证配置

powershell 复制代码
[root@ebs-135816 nginx-1.22.1]# mkdir logs
[root@ebs-135816 nginx-1.22.1]# ./sbin/nginx -t
nginx: the configuration file /home/nginx-1.22.1/conf/nginx.conf syntax is ok
nginx: configuration file /home/nginx-1.22.1/conf/nginx.conf test is successful
[root@ebs-135816 nginx-1.22.1]# 

启动服务

powershell 复制代码
[julong@localhost nginx]$ ./sbin/nginx 
在网页试着访问下http://192.168.1.222:9090/
./sbin/nginx -s reload            # 重新载入配置文件
./sbin/nginx -s reopen            # 重启 Nginx
./sbin/nginx -s stop              # 停止 Nginx
相关推荐
云飞云共享云桌面8 小时前
非标自动化研发成本高?云飞云共享云桌面:1台主机=10台工作站,年省数十万。
大数据·运维·服务器·人工智能·自动化·云计算·电脑
chehaoman9 小时前
Failed to restart nginx.service Unit nginx.service not found
运维·nginx
Linux运维技术栈9 小时前
生产环境Linux应用目录迁移至LVM独立分区 标准化实战方案
linux·运维·服务器·lvm·逻辑卷
feasibility.10 小时前
SSH Agent Forwarding 与 tmux 排障笔记
linux·运维·服务器·经验分享·笔记·ssh
ShawnLiaoking10 小时前
Linux 会话窗口常开
linux·运维·服务器
今晚务必早点睡11 小时前
Nginx 从入门到精通:一篇讲透原理、功能、配置与实战场景
运维·nginx·负载均衡
IMPYLH11 小时前
Linux 的 dir 命令
linux·运维·服务器·数据库
fanged12 小时前
操作系统番外1(Linux的测试体系)(TODO)
linux·运维·服务器
givemeacar12 小时前
Nginx如何实现 TCP和UDP代理?
tcp/ip·nginx·udp
xuefeiniao13 小时前
Docker 部署宝塔面板 Nginx 反向代理 502 踩坑实录
nginx·docker·容器