Linux上安装Nginx
Linux安装Nginx
1.首先将安装包放到服务器上,执行以下命令进行解压
tar -zxvf nginx-1.18.0.tar.gz
2.进入到nginx-1.18.0文件里执行以下命令,安装后存放的路径
./configure --prefix=/usr/local/nginx
3.配置的时候可能会出现类似这样的信息
./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= option.
执行以下指令
yum -y install pcre-devel
如果执行完出现这个问题
checking for PCRE JIT support ... not found
checking for system md library ... not found
checking for system md5 library ... not found
checking for OpenSSL md5 crypto library ... not found
checking for sha1 in system md library ... not found
checking for OpenSSL sha1 crypto library ... not found
checking for zlib library ... found
执行以下指令
yum -y install openssl openssl-devel
安装完成后,执行以下命令
./configure --prefix=/usr/local/nginx
出现以下图片说明配置成功了
四、make && make install
出现类似这样的就表示安装成功了
cp conf/nginx.conf '*/usr/local/nginx*/conf/nginx.conf.default'
test -d '*/usr/local/nginx*/logs' || mkdir -p '*/usr/local/nginx*/logs'
test -d '*/usr/local/nginx*/logs' || mkdir -p '*/usr/local/nginx*/logs'
test -d '*/usr/local/nginx*/html' || cp -R html '*/usr/local/nginx*'
test -d '*/usr/local/nginx*/logs' || mkdir -p '*/usr/local/nginx*/logs'
make[1]: Leaving directory `/root/setup/nginx/nginx-1.18.0'
安装完后*/usr/local/nginx 后出现几个文件夹conf、html、logs、sbin*
5.启动nginx:
./usr/nginx/sbin/nginx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)