Anolis系统安装nginx

Anolis系统安装nginx

一、下载安装包

登录https://nginx.org/en/download.html查看最新稳定版本,下载最新稳定版本

shell 复制代码
wget https://nginx.org/download/nginx-1.26.0.tar.gz

二、解压安装包并编译

shell 复制代码
#解压
tar -zvxf nginx-1.26.0.tar.gz
#进入文件夹
cd nginx-1.26.0
#配置并编译
./configure --with-http_ssl_module --with-http_gzip_static_module
make
make install

在配置时可能会遇到pcre的问题

shell 复制代码
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

此时可以根据提示使用--without-http_rewrite_module参数取消该模块。或者安装pcre,该文选择后者进行处理

shell 复制代码
yum install -y pcre pcre-devel

在配置时可能会遇到OpenSSL的问题

shell 复制代码
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

需要进行安装

shell 复制代码
yum install -y openssl openssl-devel

三、启动nginx

进入/usr/local/nginx/sbin目录

shell 复制代码
cd /usr/local/nginx/sbin
#启动nginx
./nginx
#查看nginx状态
ps aux | grep nginx
#加载指定conf文件
./nginx -c conf/nginx_1.conf
相关推荐
AI小小怪1 小时前
在Linux服务器上安装CVAT (Docker 28.5.1)
运维·docker·容器·数据标注·cvat
KYGALYX5 小时前
在Linux中备份msyql数据库和表的详细操作
linux·运维·数据库
余—笙5 小时前
Linux(docker)安装搭建CuteHttpFileServer/chfs文件共享服务器
linux·服务器·docker
lang201509285 小时前
Linux高效备份:tar与gzip完全指南
linux·运维·服务器
wanhengidc6 小时前
云手机的基本原理
运维·服务器·游戏·智能手机·云计算
篙芷6 小时前
两台服务器 NFS 共享目录实战
运维·服务器
Hard but lovely7 小时前
linux: centos 软件包管理 yum源
linux·运维·centos
悲伤小伞7 小时前
Linux_Socket_UDP
linux·服务器·网络·c++·网络协议·udp
2301_816073837 小时前
Chrony服务器
运维·服务器
学网络的APang7 小时前
Apache HTTP Server 2.4.65 详细安装教程(基于 CentOS 7)
运维·网络