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
相关推荐
荣光波比30 分钟前
Nginx 实战系列(七)—— Nginx一键安装脚本详解
运维·nginx·自动化·云计算
努力学习的小廉40 分钟前
深入了解linux系统—— 线程同步
linux·服务器·数据库·算法
sinat_602035361 小时前
模块与包的导入
运维·服务器·开发语言·python
鲸屿1951 小时前
Ansible之playbook
服务器·网络·ansible
网硕互联的小客服1 小时前
408 Request Timeout:请求超时,服务器等待客户端发送请求的时间过长。
运维·服务器
王伯安呢1 小时前
告别线缆束缚!AirDroid Cast 多端投屏,让分享更自由
运维·服务器·教程·投屏·airdroid cast·多端互投
逍遥浪子~1 小时前
搭建本地gitea服务器
运维·服务器·gitea
喜欢你,还有大家1 小时前
FTP文件传输服务
linux·运维·服务器·前端
胡耀超2 小时前
3.Python高级数据结构与文本处理
服务器·数据结构·人工智能·windows·python·大模型
非ban必选3 小时前
netty-scoket.io路径配置
java·服务器·前端