当前位置: 首页 > news >正文

nginx相关内容的安装

nginx的安装

安装依赖

yum install gcc gcc-c++ automake autoconf libtool make gd gd-devel libxslt-devel -y

安装lua与lua依赖

lua安装步骤如下:

mkdir /www
mkdir /www/server #选择你自己的目录即可,不需要跟我一致
cd /www/server
tar -zxvf lua-5.4.3.tar.gz
cd lua-5.4.3
make linux test
make install

luajit安装步骤如下:

cd /home
tar -zxvf luajit2-2.1-20211210.tar.gz
cd luajit2-2.1-20211210
make install PREFIX=/www/server/luaJIT

lua依赖包安装:

cd /home
tar -zxvf lua-resty-core-0.1.23rc1.tar.gz
cd lua-resty-core-0.1.23rc1
make install PREFIX=/www/server/luaJIT
​cd /home
tar -zxvf lua-resty-lrucache-0.11.tar.gz
cd lua-resty-lrucache-0.11
make install PREFIX=/www/server/luaJIT

配置luajit的环境变量:

vim /etc/profile
​
export LUAJIT_LIB=/www/server/luaJIT/lib
export LUAJIT_INC=/www/server/luaJIT/include/luajit-2.1
​
退出vim编辑后,刷新文件
source /etc/profile
​
安装nginx:
1. 解压与配置
cd /home
tar -zxvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
​
./configure --user=www --group=www --prefix=/www/server/nginx --add-module=srclib/ngx_devel_kit --add-module=srclib/lua-nginx-module --add-module=srclib/ngx_cache_purge --add-module=srclib/nginx-sticky-module --with-openssl=srclib/openssl --with-pcre=srclib/pcre --with-zlib=srclib/zlib --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-http_dav_module --add-module=srclib/nginx-dav-ext-module --add-module=srclib/nginx-upsync-module --add-module=srclib/echo-nginx-module
​
2. 编译安装并配置nginx.conf
make -j2 && make install
​
cd /www/server/nginx
避免之后的./nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory问题
​
配置如下:
echo "/www/server/luaJIT/lib" >> /etc/ld.so.conf
​
然后在刷新下配置文件
运行命令: ldconfig
​
​
vim /www/server/nginx/conf/nginx.conf
​
加入如下配置:
​
user www;
​
http
{...lua_package_path "/www/server/luaJIT/lib/lua/?.lua";
}
3. 创建用户组与启动nginx

因为在配置时我们要求使用www用户启动与操作nginx,所以需要创建这个www

1. 创建用户组与用户
groupadd www
useradd -r -g www www
2. 启动nginx
cd /www/server/nginx
sbin/nginx -c conf/nginx.conf
http://www.lryc.cn/news/320617.html

相关文章:

  • 基于SpringBoot和Echarts的全国地震可视化分析实战
  • 基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的农作物害虫检测系统(深度学习模型+UI界面+训练数据集)
  • 21 # 高级类型:条件类型
  • Java之List.steam().sorted(Comparator.comparing())排序异常解决方案
  • js判断对象是否有某个属性
  • CleanMyMac X2024永久免费的强大的Mac清理工具
  • 等保测评的知识
  • 【算法】多路归并(鱼塘钓鱼)
  • unity3d Animal Controller的Animal组件中General基础部分理解
  • css背景从上到下颜色渐变、css背景从左到右颜色渐变、 css框线展示外阴影、css框线展示内阴影
  • Nacos学习笔记
  • 微信小程序 nodejs+vue+uninapp学生在线选课作业管理系统
  • trpc-go 博客系统
  • 【JAVA】Servlet开发
  • k8s helm 删除 tiller
  • Python入门(小白友好)
  • 【数据结构与算法】:非递归实现快速排序、归并排序
  • 2024-3-18-C++day6作业
  • 【OceanBase诊断调优】—— 敏捷诊断工具obdiag一键分析OB集群日志设计与实践
  • python 调用redis创建查询key
  • 归并排序思路
  • 【蓝桥杯选拔赛真题65】python输出三个字符 第十五届青少年组蓝桥杯python选拔赛真题 算法思维真题解析
  • K8S日志收集方案-EFK部署
  • js基础语法大全(时间戳,uuid,字符串转json)
  • uView LoadingIcon 加载动画
  • Elasticsearch使用Kibana进行基础操作
  • “SRP模型+”多技术融合在生态环境脆弱性评价模型构建、时空格局演变分析与RSEI 指数的生态质量评价及拓展应用教程
  • 【Windows 常用工具系列 15 -- VMWARE ubuntu 安装教程】
  • SpringSecurity(SpringBoot2.X版本实现)
  • 仿牛客项目Day8:社区核心功能2